### CP_Sucks's blog

By CP_Sucks, history, 21 month(s) ago,

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

• +6

 » 21 month(s) ago, # |   +1 Maybe because you didn't use cout.flush()
•  » » 21 month(s) ago, # ^ |   +1 I used endl which flushes the output.
 » 21 month(s) ago, # |   -8 Just change query[len-1] with query.back()
•  » » 21 month(s) ago, # ^ | ← Rev. 2 →   0 yes it worked, but why ? What's the problem with len — 1
 » 21 month(s) ago, # |   +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.
•  » » 21 month(s) ago, # ^ |   0 Oh now i get it, Thanks a lot. Also thanks for saving me from future FSTs :)
•  » » 20 months ago, # ^ |   +3 I'm really sorry for this stupid doubt, but ivan100sic can you elaborate why would it be better to have the parantheses around n in the macro?
•  » » » 20 months ago, # ^ |   +13 Any expression with operators of priority less than '<' has. https://en.cppreference.com/w/cpp/language/operator_precedence
•  » » » » 20 months ago, # ^ |   +3 Thank you so much, that page was quite informative :)