import java.util.*;
public class Main{
static int[] a;
static int[] b;
static int l;
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
l = sc.nextInt();
a = new int [l+1];
b = new int[l+1];
for(int i = 0; i < l ; i ++){
a[i] = sc.nextInt();
}
for(int i = 0; i < l ; i ++){
b[i] = sc.nextInt();
}
int mid = findmid();
System.out.println(mid);
}
public static int findmid(){
int i = 0,j=0;
int count = 0;
int[] c = new int[2*l];
while(count < 2*l){
if( i < l && j < l ){
if(a[i] < b[j]){
c[count++] = a[i++];
}else{
c[count++] = b[j++];
}
}else if(i < l){
c[count++] = a[i++];
}else{
c[count++] = b[j++];
}
}
if(count % 2 == 0){
return c[(count - 1)/2];
}
return -1;
}
}
标签:count,int,中位数,++,static,sc,new
From: https://www.cnblogs.com/hanlinyuan/p/18289371