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

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

I got RE with submitting in c++17 and same code AC in c++14. Why is it so can someone help.

C++14 https://codeforces.net/contest/1282/submission/67691308

C++17 https://codeforces.net/contest/1282/submission/67690121

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

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

Maybe because you didn't use cout.flush()

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

Just change query[len-1] with query.back()

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

You're getting this verdict because you didn't exit immediately after printing the first query, which was the solution in that case. After that, your program will be reading from a closed stream, meaning that, for example resb will be uninitialized. The fact you passed this test case in c++14 was just pure luck.

Oh, and please put parentheses around n in your ffor macro, otherwise you'll get burned one day.