#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<cstring>
#include<cmath>
#include<map>
#define ll long long
using namespace std;
ll a[1000005],b[1000005],c[2000005];
int main()
{
int n,m,i,j,cnt;
while(scanf("%d",&n)!=EOF)
{
for(i = 1;i<=n;i++)scanf("%lld",&a[i]);
scanf("%d",&m);
for(i = 1;i<=m;i++)scanf("%lld",&b[i]);
cnt = i = j = 1;
while(i<=n&&j<=m)
{
if(a[i]<b[j])c[cnt++] = a[i++];
else c[cnt++] = b[j++];
}
if(i<=n)while(i<=n)c[cnt++] = a[i++];
if(j<=m)while(j<=m)c[cnt++] = b[j++];
printf("%lld\n",c[(n+m+1)/2]);
}
return 0;
}
pat1029 Median
最新推荐文章于 2019-07-10 21:45:00 发布