You were 9 episodes into Date a Live when you noticed that something was wrong. Who is this Kurumi character? That is when you realize you were watching Date a Live 2 the entire time. Now you need to go through the difficult ordeal of marathoning Date a Live through the night! Unfortunately, you cannot live without food through the entire night, and the anime streamer you are using still does not have a pause button. This means out of the
Input Specification
Line 1: two integers space separated,
Line 2:
The next
Output Specification
For each query, output two integers space separated. The first integer should be the highest rated episode that isn't skipped, and the second integer should be the number of episodes with this rating.
Constraints
Subtask 1 [30%]
Subtask 2 [70%]
Sample Input
7 2
5 4 5 2 3 1 5
2 4
1 6
Sample Output
5 2
5 1
Explanation of Output for Sample Input
For the first query, episodes 2 to 4 will be skipped, leaving you with episode ratings: 5 x x x 3 1 5
. The highest rated episode is 5, and both episodes 1 and 7 have this rating.
Comments
Given that the maximum rating of an episode is 3628800 (10!), those episodes must have been trash.
UMM in, "The first integer should be the highest rated episode that isn't skipped, and the second integer should be the number of episodes with this rating." and "The highest rated episode is 5, and both episodes 1 and 7 have this rating." You say "the highest rated episode" meaning you're asking for the episode which has the highest rating and not the highest episode rating.
One day..my keyboard will fly out the window.
And you along with it.
do you wanna die
Do you want to solve sketchly park?
that's a fun one