difference between code blocks and ideone.. PLEASE HELP

for the problem http://www.codechef.com/problems/LCH15JAB/
my solution is http://www.codechef.com/viewsolution/6558800

this is working fine in code blocks gcc compiler but giving WA here as well as ideone. what is the problem???

Ideone is an online compiler and codeblocks in offline compiler…

It may be working fine on codeblocks because you are not testing your program on corner or tricky test cases and thus your code is failing for that problem. Try to test tricky and corner cases…


I am sorry I am not familiar with the concept of this fast input process,


But what i found was this is the sole reason of mismatched output.

You can see here i just removed those two lines from your code and added a getchar() after taking test cases so as to take ‘\n’ and your code gave same output in codeblocks and ideone.

Here is the ideone Link:

And Output of your code in codeblocks:

alt text

1 Like

but i am giving same input in my codeblocks compiler and at ideone, and it is showing different results…in codeblocks it is showing correct answer but not at ideone.(again for same input)

can you send the ideone link here?

and the test case too… also mail me the code you are running at codeblocks @rishabhprsd7@gmail.com

i have mailed you the details