A lot of solutions (including mine) for problem B failed on test 36, and the only languages that failed in this way were C and C++. I noticed this was because in C and C++, the size of a string is an unsigned integer. This is not the same in other languages, however. Hence, if we repeat from 0
to s.size()-3
we are really repeating from 0 to some huge integer. In the case of test #36, it is 4294967294
which caused many of us to RE. No other language would have this error. Thus, a lot of substantially correct solutions got rejected because of this small semantical problem.
Did any of you who use C/C++ know that this was coming? Any suggestions on how to avoid this problem in the future? Thanks for your help.
Полный текст и комментарии »