[Solution] Mark and Professor Koro Codeforces Solution
After watching a certain anime before going to sleep, Mark dreams of standing in an old classroom with a blackboard that has a sequence of positive integers on it.
Then, professor Koro comes in. He can perform the following operation:
- select an integer that appears at least times on the board,
- erase those appearances, and
- write on the board.
Professor Koro then asks Mark the question, "what is the maximum possible number that could appear on the board after some operations?"
Mark quickly solves this question, but he is still slower than professor Koro. Thus, professor Koro decides to give Mark additional challenges. He will update the initial sequence of integers times. Each time, he will choose positive integers and , then change to . After each update, he will ask Mark the same question again.
Help Mark answer these questions faster than Professor Koro!
Note that the updates are persistent. Changes made to the sequence will apply when processing future
Mark and the Online Exam Codeforces Solution
Mark and Professor Koro Codeforces Solution
Mark and Lightbulbs Codeforces Solution
Mark and His Unfinished Essay Codeforces Solution
Mark the Dust Sweeper Codeforces Solution
Mark the Photographer Codeforces Solution
updates.
The first line of the input contains two integers and (, ) — the length of the sequence and the number of updates, respectively.
The second line contains integers ()
Then, lines follow, each consisting of two integers and (, ), telling to update to .
Print lines. The -th line should consist of a single integer — the answer after the -th update.
No comments:
Post a Comment