Yesterday, I solved Problem B in Educational Codeforces Round 167 (Rated for Div. 2), but when I submitted the solution using GNU C++20 13.2 (64 bit, winlibs), the system gave me a runtime error. (Submission Link: https://mirror.codeforces.com/contest/1989/submission/267808899)
I didn't know what caused this error, so I changed the compiler to GNU C++14 6.4.0, and somehow I got accepted! (Submission Link: https://mirror.codeforces.com/contest/1989/submission/267843646)
Does anyone have any explanation?
Same to my friend [user:@aritro_sarkar]
当
i==b.size()-length
时,b.substr(i,length)
会造成访问越界。Sorry, I forgot to use English.
When
i==b.size()-length
,b.substr(i,length)
may causeout_of_range
。