@anno Mark it as accepted answer and no problem codechef discuss is meant to help… PS i too faced problem while solving this the 1st time.
In line number 27 you can use x <<n than manually multiplying using while loop…
Tried, but it still gives TLE
No it is passing with 0.04 seconds.
Can’t see your solution on spoj. You need to give ideone or pastebin link.
Oh ,sorry…I forgot
I will…let me see to it.
What changes did you make?
Just added the input. I wasn’t giving any input.
@mathecodician using vector for R1 and R2 is slowing you down. Use arrays instead and you will get AC. Also your INF*INF
is actually overflowing which is not a problem here, but it may be an issue is some other problem so be careful about that.
You’re welcome
But the point is that I am not getting TLE. I am getting WA.
That’s strange. This is your code, right? http://ideone.com/H2wjUT
This was giving TLE, so I made the changes I just told you about, and the result was AC.
Here’s the accepted code : http://ideone.com/kUy1h1
Simply changed those vectors to array and added cin.tie(0) for fast IO.
OK got AC. Thanks everyone for helping.
That WA was coming because I had commented some part and didn’t realize it.