﻿ Fuzhou University OnlineJudge ﻿
Problem 1735 Min-Max value

Problem Description

Give you N distinct integers, and you should output the Min-Max value.
Min-Max value is defined as follows:
For the first time, we select the top [N/2] minimum integers in the N integers.
For the second time, we select the top [N’/2] maximum integers in the selected N’ integers where N’= [N/2].
For the third time, we select the top [N’’/2] minimum integers in the selected N’’ integers where N’’=[N’/2].
...
And so on.
The left one integer is the Min-Max value.
[x] is the largest integer not greater than x.

Input

There are multiple test cases. For each test case, the first line contains one integer N (1≤N≤500,000), indicating there are N integers. The next line contains N distinct integers Vi(|Vi|≤1,000,000,1≤i≤N).

Output

For each test case, output the Min-Max value.

Sample Input

6 1 2 3 4 5 6 5 1 2 3 4 5

3 2

Source

FZU 2009 Summer Training Qualification -- Hero Revival 3

Submit  Back  Status  Discuss
﻿