yuyue's blog

By yuyue, history, 4 years ago, In English

I came up with almost the same idea as the editorial . The only difference is that I queried $$$i$$$ and $$$i+1,i+2,...,n$$$ to find a magnet (I think it will be either the first or the second of them),instead of $$$i$$$ and $$$1,2,3,...,i-1$$$.And then I used the same approach just as the editorial says.

However,I got TLE on test 6. qwq

Today,I did a binary search on test 6.I get the test case that made me TLE, but it passed when I tested it locally.

I do wonder why it goes wrong.

You check my submission here 108735158

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

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

Auto comment: topic has been updated by yuyue (previous revision, new revision, compare).

»
4 years ago, # |
  Vote: I like it +5 Vote: I do not like it

Auto comment: topic has been updated by yuyue (previous revision, new revision, compare).

»
4 years ago, # |
  Vote: I like it +5 Vote: I do not like it

I think you ask $$$n$$$ + ceil($$$\log n$$$) queries, one more than the limit.

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

    Thanks! It seems that you are right. But it did confused me when I received TLE instead of Wrong Answer.