1 #include<cstdio>
2 #include<iostream>
3 #include<algorithm>
4 #include<queue>
5
6 using namespace std;
7
8 const int maxn = 100005;
9
10 int cnt;
11
12 struct node{
13 int id, nr, cnt;
14 } p[maxn];//结构体
15
16 bool operator < (node x, node y){
17 return x.nr > y.nr;
18 }//重载运算符
19
20 priority_queue <node> q;
21
22 int n, a[maxn], b[maxn];
23
24 int main(){
25 scanf("%d", &n);
26 for(int i = 1; i <= n; i++){
27 scanf("%d", &a[i]);
28 p[i].id = i;
29 p[i].cnt = 1;
30 }
31 for(int i = 1; i <= n; i++) scanf("%d", &b[i]);
32 sort(a + 1, a + n + 1);
33 sort(b + 1, b + n + 1);
34 for(int i = 1; i <= n; i++){
35 p[i].nr = a[1] + b[i];
36 q.push(p[i]);
37 }
38 for(int i = 1; i <= n; i++){
39 int ans = q.top().nr;
40 printf("%d ", ans);
41 node u;
42 u.cnt = q.top().cnt + 1;
43 u.id = q.top().id;
44 q.pop();
45 u.nr = a[u.cnt] + b[u.id];
46 q.push(u);
47 }
48 return 0;
49 }