# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1065447 | MunkhturErdenebat | A Plus B (IOI23_aplusb) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include <string.h>
#include <stdlib.h>
#define ll long long
using namespace std;
long long dfghjkl;
long long tem,a,e,d,g=0,c,h=0,k[300011],me[4001230],m,t[1234567],n,i,j,f,mi,ha,he,ko,ka;
string o,y,x[123456],z;
long long ul,ma;
char mr,taxi;
long long bb,b;
double xxx;
pair<ll,long long> zxdfghj;
vector<long long> q,kii;
map<long long,long long> maa;
int main() {
cin>>a;
for(i=0 ; i<a ; i++){
cin>>k[i];
}
for(i=0 ; i<a ; i++){
cin>>t[i];
}
sort(k,k+a);
sort(t,t+a);
g=0;
h=0;
for(i=0 ; i<a ; i++){
cout<<k[g]+t[h]<<" ";
if(k[g+1]+t[h]>k[g]+t[h+1]){
h++;
}
else{
g++;
}
}
}