src2020/3052_hebing/main.cpp

33 lines
651 B
C++

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
vector<int> has;
int yi[100001]={0},er[100001]={0};
int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>yi[i];
}
for(int i=0;i<n;i++){
cin>>er[i];
}
sort(yi,yi+n);
sort(er,er+n);
int maxs=yi[0]+er[n-1];
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
int now=yi[i]+er[j];
if(i==0||now<maxs){
has.push_back(now);
}
}
}
sort(has.begin(),has.end());
for(int i=0;i<n;i++){
cout<<has[i]<<" ";
}
}