//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
/*
ID: samikgo1
TASK:
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef complex<ll> point;
#define X real()
#define Y imag()
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
//#define f first
//#define s second
//#define x first
//#define y second
const ll INF = INT32_MAX;
const ll sqrtn = 440;
const ll modulo = 998244353;
const ll siz = 2e6;
const ll hashp = 923981238;
const ll hashm = 932439994;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//#define int ll
std::vector<int> smallest_sums(int N, std::vector<int> A, std::vector<int> B) {
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<>> q;
vector<int> ans(N);
vector<int> curr(N,0);
for(int i=0;i<N;i++)q.emplace(A[i]+B[0],i);
for(int i=0;i<N;i++){
auto top = q.top();q.pop();
ans[i] = top.first;
q.emplace(A[top.second]+B[++curr[top.second]],top.second);
}
return ans;
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
// freopen("cses.fi.txt","r",stdin);
// freopen(".out","w",stdout);
// int t;
// cin >> t;
// while (t--)
int n;
cin >> n;
vector<int> a(n),b(n);
for(int&i:a)cin>>i;
for(int&i:b)cin>>i;
for(int&i:smallest_sums(n,a,b))cout<<i<<' ';
}
Compilation message
/usr/bin/ld: /tmp/cc9GaBzI.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccuIwL2J.o:aplusb.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status