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

Автор AnasAbbas, история, 8 лет назад, По-английски

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://codeforces.me/contest/706/submission/20629423

accepted :http://codeforces.me/contest/706/submission/20629645

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

»
8 лет назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

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://codeforces.me/contest/706/submission/20630096