manetsus's blog

By manetsus, 11 years ago, In English

At first have a look on my these two submissions linked below then we will discuss.

http://codeforces.me/contest/253/submission/4619780

http://codeforces.me/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://codeforces.me/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

  • Vote: I like it
  • +7
  • Vote: I do not like it

| Write comment?
»
11 years ago, # |
Rev. 3   Vote: I like it -16 Vote: I do not like it

Sorry I got it wrong.......

  • »
    »
    11 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    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

  • »
    »
    11 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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://codeforces.me/contest/253/submission/6191897

    I hope you understood. Happy coding :)

»
11 years ago, # |
Rev. 3   Vote: I like it -42 Vote: I do not like it

manetsus ভাই লাইক এ বস!!!

  • »
    »
    11 years ago, # ^ |
      Vote: I like it -6 Vote: I do not like it

    THIS IMAGE VERY BIG !!!

  • »
    »
    11 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    J-C, I think you might understand how boss I am!

    • »
      »
      »
      11 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      ইয়া আপারেন্টলি নোবোডি ইস টলারেটিং বেয়াদবি উইথ দ্যা বস...