# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
881741 | spdling | A Plus B (IOI23_aplusb) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
vector<int> smallest_sums(int N, vector<int> A, vector<int> B) {
vector<int> ans;
int ans_n = 0;
set<pair<int, pair<int, int>>> cands;
for (int i = 0 ; i < N; ++i) {
cands.insert({A[i] + B[0], {i, 0}});
}
while (ans_n < N) {
auto cur = cands.begin();
ans.push_back(cur->first);
ans_n++;
int i = cur->second.first;
int j = cur->second.second;
cands.erase(cur);
if (j+1 < N) {
cands.insert({A[i] + B[j+1], {i,j+1}});
}
}
return ans;
}