suncongbo's blog

By suncongbo, history, 3 years ago, In English

In the contest yesterday Codeforces Round 698 (Div. 1) I submitted 1477B - Nezzar and Binary String two times (105735241 and 105747088), both of the got verdict "TLE on pretest 2". So I spent much time trying to find the reason but failed. Today I just submitted the exactly same code as 105747088, and its verdict changed to "WA on test 2"! (105792669)

The truth is the code was wrong, so WA is the correct verdict. But where did TLE come from?

Could anyone explain about it to me? Thanks a lot!

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

»
3 years ago, # |
  Vote: I like it +41 Vote: I do not like it

I think split() have something wrong.

set<Element>::iter ret = odt.insert((Element){tmp.l,pos,tmp.x}).first; odt.insert((Element){pos+1,tmp.r,tmp.x});

ret may become an invalid pointer.

Your program using C++17 to submit will get TLE, and using C++17(64) to submit will get WA.

I think there's something wrong inside set.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +13 Vote: I do not like it

    You're right. Thank you very much.

    I didn't know that invalid pointer will lead to TLE. Also didn't I realize that I used different languages to submit.

    Sorry...I'm so weak.