P29541 [洛谷] [COCI2014-2015#4] PŠENICA
普及+
题目描述

Problem Description

Mirko and Slavko plant Christmas wheat every year on Saint Lucy's Day. The stems of the wheat grow at different rates, and after some time, the wheat becomes quite messy. They decide to solve this problem by playing a game that proceeds in turns as follows:

  • Mirko selects a stem with the smallest height and changes its height to the second smallest value.
  • Slavko selects a stem with the largest height and changes its height to the second largest value.
  • If the number of distinct heights remaining is not less than $3$, the game continues; otherwise, it ends, and the player who needs to make the next move is the loser.

Given the heights of the wheat stems, Mirko starts first. Determine the winner of the game and the smallest and largest heights after the game ends.

Input Format

The first line of input contains the integer $n$, the number of wheat stems.

The second line of input contains $n$ space-separated integers $h_i$, representing the height of each wheat stem.

Output Format

The first line of output should contain the name of the winner (Mirko or Slavko).

The second line of output should contain the smallest and largest heights of the stems after the game ends.

Sample Input and Output

Sample Input #1

3
3 3 3

Sample Output #1

Slavko
3 3

Sample Input #2

4
3 1 2 1

Sample Output #2

Slavko
1 2

Sample Input #3

7
2 1 3 3 5 4 1

Sample Output #3

Slavko
2 3

Notes

Sample 1 Explanation

Mirko cannot make a move initially, so Slavko is the winner.

Data Constraints

  • For $50\%$ of the test cases, $1 \le n \le 500$.
  • For $80\%$ of the test cases, $1 \le n \le 3 \times 10^3$.
  • For $100\%$ of the test cases, $1 \le n \le 10^5$.

For all valid $h_i$, $1 \le h_i \le 10^5$.

Note

This problem is translated from COCI2014-2015 CONTEST #4 T2 PŠENICA.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 3 3 3
样例输出
Slavko 3 3