#include<bits/stdc++.h>
#define mp make_pair
#define mod 1000000007
using namespace std;
typedef long long ll;
inline ll read()
{
ll x=0,flag=1;
char c=getchar();
while(c<'0'||c>'9')
{
if(c=='-') flag=-1;
c=getchar();
}
while(c>='0'&&c<='9')
{
x=(x<<1)+(x<<3)+c-'0';
c=getchar();
}
return x*flag;
}
ll qpow(ll x,ll y)
{
ll ans=1;
while(y)
{
if(y%2) ans=ans*x%mod;
x=x*x%mod;
y=y/2;
}
return ans;
}
ll a[100005];
ll b[100005];
struct node
{
ll x;
ll y;
bool operator < (const node bb)const
{
return (a[x]+b[y])>(a[bb.x]+b[bb.y]);
}
};
priority_queue<node>q;
map<pair<ll,ll>,ll>qq;
ll n;
bool check(ll x,ll y)
{
if(x<=n&&y<=n) return 1;
return 0;
}
int main()
{
n=read();
for(int i=1; i<=n; i++)
{
a[i]=read();
}
for(int i=1; i<=n; i++)
{
b[i]=read();
}
ll num=0;
node now;
now.x=1;
now.y=1;
q.push(now);
while(num<n)
{
num++;
node now=q.top();
q.pop();
printf("%lld ",a[now.x]+b[now.y]);
node nextt;
nextt.x=now.x+1;
nextt.y=now.y;
if(check(now.x+1,now.y)&&qq[mp(now.x+1,now.y)]==0)
{
qq[mp(now.x+1,now.y)]=1;
q.push(nextt);
}
nextt.x=now.x;
nextt.y=now.y+1;
if(check(now.x,now.y+1)&&qq[mp(now.x,now.y+1)]==0)
{
qq[mp(now.x+1,now.y)]=1;
q.push(nextt);
}
}
printf("\n");
return 0;
}
结果WA了