fcspartakm's blog

By fcspartakm, history, 7 years ago, translation, In English
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
  • Vote: I like it
  • -21
  • Vote: I do not like it

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

Provide full translation, please.

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

Can somebody explain how the autocompletion works in 928D - Autocompletion?

The first example, why is "snowboard" available after typing "sn"? There was an instance of "snow" before, but non of "snowboard". So the autocompletion should make "snow" available, not "snowboard".

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

    "sn"----auto---->"snow"---continue to type---->"snowboard".

    The messy thing here is after you autocomplete a word, you could type latin characters after it.

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

    Btw I'm having trouble understanding sample case 3. If you are still working on this problem maybe we could cooperate :))

    UPD: I have completed it maybe another occasion :)

»
6 days ago, # |
  Vote: I like it 0 Vote: I do not like it

I am quite surprised by the second question. The code below passes the question under the official testcases:

Code

However, the test cases are quite weak because this merge intervals approach is rather brute force. The worst-case scenario is when ( n = 10^5 ) and ( k = 0 ), with links being ( 0, 1, 2, 3, 4, 5, ..., n-1 ).

The above code even fails for ( n = 10^4 ), so I would say the test cases are quite weak.

But the editorial code is correct and passes this extreme test case.

I still wonder how this could happen in an official and recognized competition!