ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1133. Fibonacci Sequence

HINTs for WA15
Posted by Erko 27 Jan 2009 21:51
I tried solve this problem 6 times and 3 of their are WA15,
This WA is expects when uses binsearch, when I replaced type of numbers from long to BigInteger in java, I got AC, in this 15' test intermediate(промежуточные) numbers bigger than 2000000000 or lower than -2000000000, that is why we have wrong answers ))
Good luck!

Edited by author 27.01.2009 21:59
Re: HINTs for WA15
Posted by kima 4 Mar 2009 01:29
then 15 test incorrect.
Re: HINTs for WA15
Posted by Connector 1 Jun 2010 16:57
I use binsearch and long long in C++, all is ok.
by finding value with BS you can take for example 10^9
and if the previous value is 10^9 then you get the following sequence
10^9, 10^9, 2*10^9, 3*10^9, 5*10^9, and so on.
by overflowing the integer and long types the answer is wrong
I used next hint:
for (.........)
{
....
if (fib[i] > 2*10^9)
fib[i] = 2*10^9 +1;
if (fib[i] < -2*10^9)
fib[i] = -2*10^9 -1;
}

Edited by author 01.06.2010 16:57

Edited by author 01.06.2010 16:57
Re: HINTs for WA15
Posted by adrian 6 Oct 2010 22:19
Thank you very much, it is just the reason why I got a WA at #15.
Re: HINTs for WA15
Posted by agtr 18 Oct 2010 17:10
I tried what you say, but also WA15. I can't understand why??
Re: HINTs for WA15
Posted by [NKU]sweet 23 Jan 2011 11:47
Well,that was worse....Thanks for hint
Re: HINTs for WA15
Posted by SButterfly [Samara SAU] 4 Nov 2014 22:23
Thanks man