# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1092201 | Luvidi | A Plus B (IOI23_aplusb) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
std::vector<int> smallest_sums(int n, std::vector<int> a, std::vector<int> b) {
long long l=0,r=2e9;
while(l<r){
long long m=(l+r)/2,cnt=0,idx=n-1;
for(int i=0;i<n;i++){
while(idx>=0&&a[i]+b[idx]>m)idx--;
cnt+=idx+1;
}
if(cnt>=n)r=m;
else l=m+1;
}
vector<int> ans;
for(int i=0;i<n;i++){
for(int j=0;j<n&&a[i]+b[j]<l;j++){
ans.push_back(a[i]+b[j]);
}
}
sort(ans.begin(),ans.end());
while(ans.size()<n)ans.push_back(l);
return ans;
}