Codeforces and Polygon may be unavailable from December 6, 19:00 (UTC) to December 6, 21:00 (UTC) due to technical maintenance. ×

Tensor's blog

By Tensor, 10 years ago, In English

I'm solving this problem but there is a little problem for first test case my solution on visual studio returns (2 6) the right answer. after submitting i get wrong answer on test case 1!! getting (1 6) either than (2 6). here is my code please can any one tell me what's the problem?!! thanks in advance!

  • Vote: I like it
  • -3
  • Vote: I do not like it

»
10 years ago, # |
  Vote: I like it +6 Vote: I do not like it

Our old friend, the undefined behavior, strikes again! See, for instance, this:

http://stackoverflow.com/questions/11132236/why-does-increment-operation-like-ai-i-result-in-undefined-behavior

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

    thank you, i know what's wrong now :-)