bhikkhu's blog

By bhikkhu, history, 9 years ago, In English

http://codeforces.net/problemset/problem/518/B

I wrote two naive solutions that should have both resulted in TLE. But one is showing wrong answer.

The only difference in both the solutions is that in Sol A, I mark the character to be removed as '0' whereas in the next one I actually remove the character from the string. But the solution in which I remove

the character is showing wrong answer instead of TLE. Could andybody explain what caused the judge to produce different decisions?

Solution A : TLE http://codeforces.net/contest/518/submission/11545724

Solution B: Wrong Answer http://codeforces.net/contest/518/submission/11545764

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

guess there is difference between erasing and setting value to '0'

string& erase (size_t pos = 0, size_t len = npos);

Erases the portion of the string value that begins at the character position pos and spans len characters (or until the end of the string, if either the content is too short or if len is string::npos)