import java.io.PrintWriter; import java.util.Arrays; import java.util.Random; import java.util.Scanner; public class Main implements Runnable { //Runnableを実装する public static void main(String[] args) { // new Thread(null, new Main(), "", 16 * 1024 * 1024).start(); //16MBスタックを確保して実行 new Main().run(); } final long INF=Long.MAX_VALUE/3; long f(long[] a, boolean maximize) { if (a.length==1) return a[0]; long ret=maximize?-INF:INF; for (int i=0;i<=a.length;++i) { long[] na=new long[a.length]; for (int j=0;j1) { long m=(ok+ng)/2; int cnt=0; for (int i=0;i= m) ++cnt; i=j; } if (cnt>=(n+1)/2) ok=m; else ng=m; } return ok; } long solve(long[] a) { return a.length%2==0?solve_even(a):solve_odd(a); } public void run() { Scanner sc=new Scanner(System.in); PrintWriter pw=new PrintWriter(System.out); // Random rnd=new Random(); // while (true) { // int N=rnd.nextInt(1,10); // long[] a=new long[N]; // for (int i=0;i