AnasAbbas's blog

By AnasAbbas, history, 8 years ago, In English

i had runtime error in this submission and i was going crazy finding where the error is

after 2 hours of debugging and tracing .. i didn't find the problem .. i did something stupid and the problem got accepted .. i don't know why actually ...

does any one knows where was the error in the first code ? ?

and why C++ behaves like that

run time error : http://mirror.codeforces.com/contest/706/submission/20629423

accepted :http://mirror.codeforces.com/contest/706/submission/20629645

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

»
8 years ago, # |
  Vote: I like it +1 Vote: I do not like it

I'm not sure why the second code was accepted, but the first one was RE because you didn't put '\0' in the end of the char array, and it's necessary to indicate the end of the string.

This code was accepted only adding '\0' in the end of "res" in first code: http://mirror.codeforces.com/contest/706/submission/20630096

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

    thank you ... the reason for the Accepted code remains a mystery :D