spoj GSS1 problem

@anno Mark it as accepted answer :smiley: 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…

1 Like

Tried, but it still gives TLE

1 Like

No it is passing with 0.04 seconds.

1 Like

@neilit1992 does that make any difference?

1 Like

Can’t see your solution on spoj. You need to give ideone or pastebin link.

1 Like

Oh ,sorry…I forgot

I will…let me see to it.

1 Like

@mathecodician please show your working code.

1 Like
1 Like

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.

1 Like

You’re welcome :slight_smile:

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.

3 Likes

@mathecodician it gives TLE on SPOJ, How come you get WA?

alt text

@mathecodician

Here’s the accepted code : http://ideone.com/kUy1h1

Simply changed those vectors to array and added cin.tie(0) for fast IO.

1 Like

OK got AC. Thanks everyone for helping.

1 Like

That WA was coming because I had commented some part and didn’t realize it.

1 Like

@mathecodician, @meooow is never wrong :smiley:

1 Like