Блог пользователя manetsus

Автор manetsus, 10 лет назад, По-английски

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

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

http://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://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

  • Проголосовать: нравится
  • +7
  • Проголосовать: не нравится

»
10 лет назад, # |
Rev. 3   Проголосовать: нравится -16 Проголосовать: не нравится

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

  • »
    »
    10 лет назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    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

  • »
    »
    10 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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.com/contest/253/submission/6191897

    I hope you understood. Happy coding :)

»
10 лет назад, # |
Rev. 3   Проголосовать: нравится -42 Проголосовать: не нравится

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