#P7175. [COCI 2014/2015 #4] PŠENICA
[COCI 2014/2015 #4] PŠENICA
Description
Every year on Saint Lucy’s Day, Mirko and Slavko plant Christmas wheat. The stalks grow at different speeds, and after some time the wheat becomes quite messy. They decide to fix this by playing the following game, which repeatedly proceeds in turns as follows:
- Mirko chooses a stalk with the minimum height and changes its height to the second minimum value.
- Slavko chooses a stalk with the maximum height and changes its height to the second maximum value.
- If the number of distinct remaining heights is at least , the game continues; otherwise it ends, and the player who is to move next is the loser.
Given the heights of the wheat stalks, Mirko moves first. Determine the winner of the game and the minimum and maximum heights after the game ends.
Input Format
The first line contains an integer , the number of wheat stalks.
The second line contains space-separated integers , the height of each wheat stalk.
Output Format
On the first line, output the winner’s name (Mirko or Slavko).
On the second line, output the heights of the shortest and the tallest stalk when the game ends.
3
3 3 3
Slavko
3 3
4
3 1 2 1
Slavko
1 2
7
2 1 3 3 5 4 1
Slavko
2 3
Hint
Sample 1 Explanation
At the beginning, Mirko cannot make a move, so Slavko is the winner.
Constraints
- For of the testdata, .
- For of the testdata, .
- For of the testdata, .
For all valid , .
Note
This problem is translated from COCI2014-2015 CONTEST #4 T2 PŠENICA.
Translated by ChatGPT 5
京公网安备 11011102002149号