이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
vector<int> smallest_sums(int N, vector<int> A, vector<int> B)
{
int n = N;
auto a = A, b = B;
priority_queue<tuple<int, int, int>, vector<tuple<int, int, int>>, greater<>> pq;
for (int i = 0; i < n; i++)
pq.push({a[i] + b[0], i, 0});
vector<int> ans;
while (ans.size() < n)
{
int val, x, y;
tie(val, x, y) = pq.top();
pq.pop();
ans.push_back(val);
if (y + 1 < n)
pq.push({a[x] + b[y + 1], x, y + 1});
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
aplusb.cpp: In function 'std::vector<int> smallest_sums(int, std::vector<int>, std::vector<int>)':
aplusb.cpp:11:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
11 | while (ans.size() < n)
| ~~~~~~~~~~~^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |