Hepic_Antony_Skarlatos's blog

By Hepic_Antony_Skarlatos, history, 9 years ago, In English

I submited in the D problem a O(n^3) logic because of 4 seconds,but it took TLE. Here it is: http://mirror.codeforces.com/contest/552/submission/11650074

In the comments I saw a source similar to me: http://mirror.codeforces.com/contest/552/submission/11648192 that passed.

What is wrong with mine?

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

you have a problem with your REP. check it again :))

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

If you do the math O(n ^ 3) will be arround 10^9 which is a lot (codeforces' servers allow arround 10^8 per second). And If you care about learning seek for something better.
Hint: check the given constrains and try to reduce your time complexity :D

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

    O(n^3) passes here in Codeforces for this problem within the TL.