Its been quite a long time since i got inspiration to solve SPOJ problems. Then i hear about this problem and how binary search could create problems in it. So deciding to give it a go (c’mon how tough can binary search be??) i start coding it up. About 20 wrong attempts on my PC and TLE exceeded 5 times on SPOJ, finally realised i was doing binary search on the quantity with a smaller bounds and normal iteration through the one with larger bounds. .!!! One wrong submission later (submitted it in ADA instead of c++
) finally got ACC. .
The problem can be found here. .
http://www.spoj.pl/problems/AGGRCOW/
Cheers
The problem can be found here. .
http://www.spoj.pl/problems/AGGRCOW/
Cheers