305169: CF984A. Game
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Game
题意翻译
两个人玩游戏,游戏规则是: 写在黑板上的n个数字。每个回合一个玩家选择一个数字并从黑板上删除它。这一直持续到板上只剩下一个数字。第一个玩家先删除,然后第二个玩家删除。 第一个玩家想要留在棋盘上的最后一个数字最小,而第二个玩家想要最大。 请问最后留在这个黑板上的数字是什么? 感谢@something 提供的翻译题目描述
Two players play a game. Initially there are $ n $ integers $ a_1, a_2, \ldots, a_n $ written on the board. Each turn a player selects one number and erases it from the board. This continues until there is only one number left on the board, i. e. $ n - 1 $ turns are made. The first player makes the first move, then players alternate turns. The first player wants to minimize the last number that would be left on the board, while the second player wants to maximize it. You want to know what number will be left on the board after $ n - 1 $ turns if both players make optimal moves.输入输出格式
输入格式
The first line contains one integer $ n $ ( $ 1 \le n \le 1000 $ ) — the number of numbers on the board. The second line contains $ n $ integers $ a_1, a_2, \ldots, a_n $ ( $ 1 \le a_i \le 10^6 $ ).
输出格式
Print one number that will be left on the board.
输入输出样例
输入样例 #1
3
2 1 3
输出样例 #1
2
输入样例 #2
3
2 2 2
输出样例 #2
2