Codeforces and Polygon may be unavailable from December 6, 19:00 (UTC) to December 6, 21:00 (UTC) due to technical maintenance. ×

Eyad_Hantouli's blog

By Eyad_Hantouli, history, 5 months ago, In English

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://codeforces.net/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://codeforces.net/contest/1989/submission/267843646)

Does anyone have any explanation?

  • Vote: I like it
  • +1
  • Vote: I do not like it

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Same to my friend [user:@aritro_sarkar]

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it
    for (ll i = 0; i <= b.size() - length; ++i)
        substrings.insert(b.substr(i, length));

i==b.size()-length 时,b.substr(i,length) 会造成访问越界。

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it
    for (ll i = 0; i <= b.size() - length; ++i)
        substrings.insert(b.substr(i, length));

Sorry, I forgot to use English.

When i==b.size()-lengthb.substr(i,length) may cause out_of_range