At first have a look on my these two submissions linked below then we will discuss.
http://mirror.codeforces.com/contest/253/submission/4619780
http://mirror.codeforces.com/contest/253/submission/6190230
Can you see any difference between them? Oh! their verdict are totally different! But have a look on the codes. Does there any difference exist? The correct answer is no! you can check taking these two to any comparator.
The accepted one is dated on Oct 1, 2013 4:00:13 PM and the wrong answer one is dated on today!
But Codeforces changed a lot in the mean time, I think. They are not allowing "r+" or "w+" anymore, I think. The behavior of these two things are suspicious now!
Just open my code and delete two '+' signs from line no 5 and 6 and submit.
Thats it! Again accepted!
http://mirror.codeforces.com/contest/253/submission/6190385
But I discovered this in the contest time which held in our institution in hust online judge!
So, be aware of using "w+" and "r+".
Have a nice day!
Enam,
CSE,SUST
Sorry I got it wrong.......
Some codeforces problems actually require file I/O, but there are very few of them.
For example, 253A - Boys and Girls, which were used in this post
EROR, I think you got the answer from nic11's comment. There are some problem's which will not be accepted without handling input and output from and to the described file. This problem is one of them. freopen just takes the input from the file described instead of standard input without any extra changing in code(i.e, using fscanf() ). Similarly it does the same thing for the output. You can see the consequence of erasing these two lines in this link : http://mirror.codeforces.com/contest/253/submission/6191897
I hope you understood. Happy coding :)
manetsus ভাই লাইক এ বস!!!
THIS IMAGE VERY BIG !!!
J-C, I think you might understand how boss I am!
ইয়া আপারেন্টলি নোবোডি ইস টলারেটিং বেয়াদবি উইথ দ্যা বস...