b4world's blog

By b4world, history, 9 years ago, In English

Why did this code time out during contest. I cannot figure it out. If someone can please help on this ? http://mirror.codeforces.com/contest/567/submission/12374052

  • 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

I may be wrong, but the while loops that count the number of boats that can fit after each of Bob's moves TLE the program. There isn't anything wrong with the set. I did a similar thing on the contest, but I checked the number of boats that can fit in O(1) time. Here's my submission: 12370417

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

It may be the case. But I highly doubt it because according to me it will run a constant number of times and in most cases as far as I can think, atmost twice.

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

    Your while loops seem cryptic to me. What does r1,r2,s1,s2,...etc represent?