techwiz911's blog

By techwiz911, 3 months ago, In English

Hi CF community!

I was practicing some virtual contests recently and I happened to run into a very peculiar compilation issue. I was trying this problem and for some reason, I kept getting TLE on test case 1, submission here with limit at 2s. It frustrated me to no end because the code is really short and it cannot possibly TLE on the sample test case unless I am losing my mind.

Then, in sheer desperation, I decided to change the compiler to G++17 from G++20, and voila, accepted in like 100ms!

I am not very familiar with the differences in compilation please, can someone educate me on why this happened and how to prevent it in the future? Thank you in advance.

Full text and comments »

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

By techwiz911, history, 9 years ago, In English

I was attempting the following question 310D

Here is my submission that timed-out TLE

And here is my submission that was accepted AC

As you may have observed, the only change I made from the TLE code to AC code was

  it=lower_bound(s.begin(),s.end(),mp(lo,o));

to

  it=s.lower_bound(mp(lo,o));

where "it" is a set iterator.

Just changing this, the time on Test #11 was reduced from >3000ms to 264ms. Can any one shed some light on why this happened? Thank you.

Full text and comments »

  • Vote: I like it
  • -4
  • Vote: I do not like it