#P13309. 演剧
演剧
Description
Yuki and K are playing a game on a sequence of length .
Yuki and K take turns to act. Yuki moves first. In each operation, the current player can split the sequence into two non-empty parts at a division point, and then the opponent in the game will delete one of the parts. The game continues with the remaining part.
Specifically, in the first round, Yuki splits and K deletes; in the second round, K splits and Yuki deletes; in the third round, Yuki splits and K deletes, and so on.
The game ends when only one number remains and no further operations can be performed. Yuki wants to maximize the last remaining number, while K wants to minimize it.
Assuming both players are infinitely smart, determine the final remaining number.
Input Format
The input contains test cases. The first line of input has an integer .
For each test case, the first line contains a positive integer .
The second line of each test case contains positive integers, where the -th integer is .
Output Format
For each test case, output an integer representing the final remaining number.
2
5
1 4 3 1 5
4
1 3 3 1
3
3
Hint
Explanation for the first sample: If Yuki chooses to split the sequence into the left 2 numbers and the right 3 numbers:
- If K deletes the right part, the remaining sequence is and . Yuki can then ensure the final number is when K splits.
- If K deletes the left part, the remaining sequence is . No matter how K splits next, Yuki can ensure the answer is no less than .
Further analysis shows that the answer is .
| Test | |
|---|---|
For all data, , , .
京公网安备 11011102002149号