Блог пользователя enoone

Автор enoone, история, 9 лет назад, По-английски

Hello everyone I am trying to solve the problem Game from this year's eJOI contest. I know the solution for 60 points (with priority_queue and prefixes), but i'd like to know the solution for 100 points. If there is anyone who has solved it, please tell the solution. Thanks

P.S if you want we can discuss other problems in comments :)

Problems day 1, day 2.

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

»
9 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +8 Проголосовать: не нравится

The required complexity was O(NK). For each query we will solve the complexity will be O(N).

Now we need to be able fast to find the largest element. It's pretty easy. As the elements are  ≤ N we can store for every of the numbers how many times does it appear in the current set. Let's also store the current maximum. For the initial set we simply will itterate all elements, increase the count and find the maximum. Now when we add a element it can either be  ≥  current maximum or  <  than the current maximum. If it's  ≥  we are sure that we will take this number at the current position. Else we will increase the count of the current element. Now we are left just witg finding the new maximum. Well we simply can decrease the current maximum untill we are at a value with count greater than 0. We will decrease the current maximum at most N times and so the complexity will be O(N).

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +16 Проголосовать: не нравится

"If there is anyone who solved it" Does being a problemsetter count? =)

Radoslav's radoslav11 solution is the intended one. Some participants used a weird DSU or other approaches. I am eager to know others!

Fun fact from backstage — it was intended to be by far the easiest problem of the second day ;-;

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

OK I now want to discuss the problem Camel of the second day. You can easily get th solution for n=5, so it is 20 points. I think for n>5 i think we must separate it to 5*5 blocks and combine them to get the hole solution. Am I right?