SaBuZa's blog

By SaBuZa, history, 8 years ago, In English

Because my friend's English is not very good, I am asking this question on his behalf.

He says on problem E of yesterday's round, he was debugging and finally got accepted but found that he could only get accepted with a debugging if statement that is supposed to be useless.

When he removes the if statement, it gets wrong answer on test case 38. However, when the if statement is included (highlighted in green in the image), it is accepted but the commands in the if statement are not even executed.

It is very confusing for me that the addition of an if statement that does nothing to change the values of any variables could change the output of the program.

The two submissions can be found here: http://codeforces.com/contest/681/submission/18481671 (Accepted with if statement) http://codeforces.com/contest/681/submission/18481662 (Wrong answer without if statement)

Does anyone have any explanation for this phenomenon?

Full text and comments »

Tags c++
  • Vote: I like it
  • +42
  • Vote: I do not like it