### c2h5sh's blog

By c2h5sh, history, 7 weeks ago,

Running this code locally gives Runtime Error on test 3 due to this:

s.erase(s.find(cnt));


Which I replaced by this:

auto itr = s.find(cnt);
if (itr != s.end())
s.erase(itr);


And it passed all test.

It took me less than a minute to figure out that deletion might be causing RE.

But during the contest, I spent more than an hour thinking about why it was giving TLE.

Is this normal behaviour on Codeforces compilers or is it a bug. If it's normal, then how do we deal with such verdicts (a TLE which actually is just a RE)?

• +3

 » 7 weeks ago, # |   -21 That is really unfortunate bro, it definitely isn't TLE, it clearly was a Runtime Error, but the system showed a wrong verdict
 » 7 weeks ago, # |   +18 Actually this is not guaranteed to be runtime error, as this operations causes undefined behavior. And undefined behavior is just that, undefined. You could have got any verdict
 » 7 weeks ago, # |   +5 This same problem happened to me on pretest 3 and I thought my solution was too slow because of the judge's verdict. It is unfortunate that it gave me TLE because if it had given me RTE, I might've had a better idea of what to debug. It was simply my fault for not understanding the STL and the undefined behavior :(.