ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1948. The Robot on the Line

Test question
Posted by Серовиков Андрей 10 Mar 2013 20:25
What's the answer for this test?
3
1 1 1
25000000 10001 1
1 -90000 -999890001
Test question
Posted by Серовиков Андрей 3 Apr 2013 18:34
I'm using BigInteger arithmethic and BinSearch, but still WA2...
1) D<0: answer 1
2) sum(0, k-1):f(x1+i) -> as result, we need to compare a^2*(2*k-1)^2 and 9*D

what's wrong?

Edited by author 03.04.2013 18:40
Re: Test question
Output of my (AC) program:
1
2
190523

I used standard C++ double type to solve it - it seems there're no difficult tests that fail it (or such tests are just impossible)
Re: Test question
BTW, for the case (2) my solution considers two different cases
Re: Test question
Posted by Серовиков Андрей 4 Apr 2013 14:58
I found bug in logic, but still...
1) D<0: 1
2) a) sum(0, k-1):f(x0+0.5+i) -> as result, we need to compare F(x0+0.5) and a*(k-1)/2.0 + a*(k-1)*(2*k-1)/6.0 -> then multiply by 2
   b) sum(0, k-1):f(x0+i) -> as result, we need to compare F(x0)/2.0 and a*(k-1)*(2*k-1)/6.0 -> then multiply by 2 and substract 1

Some more tests:
7
1 1 0
1 6 -9
1 0 -1
1 1000000000 -1000000000
1000000000 -1000000000 -1000000000
1234 987654321 -987654321
100000000 987654321 -987654321