# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
844357 | matan | A Plus B (IOI23_aplusb) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <vector>
#include <algorithm>
#include <queue>
std::vector<int> smallest_sums(int N, std::vector<int> A, std::vector<int> B){
std::vector<int> C(N);
std::vector<int> CC_index(N, 0);
std::vector<int> C(N);
std::priority_queue<std::pair<int, int>, std::vector<std::pair<int, int>>, std::greater<std::pair<int, int>>> pq;
for (int i = 0; i < N; i++) {
pq.push({A[i] + B[0], 0});
}
int k = 0;
while (k < N) {
auto [sum, j] = pq.top();
pq.pop();
C[k++] = sum;
if (j < N - 1) {
pq.push({sum - B[j] + B[j + 1], j + 1});
}
}
return C;
}