This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "aplusb.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> smallest_sums(int N, vector<int> A, vector<int> B) {
vector<int> C(N, 0);
priority_queue<array<int, 3>, vector<array<int, 3>>, greater<array<int, 3>>> pq;
for(int i = 0; i < N; i ++) pq.push({A[i] + B[0], i, 0});
int M = 0;
while(!pq.empty() && M < N) {
int x = pq.top()[0];
int i = pq.top()[1];
int j = pq.top()[2];
pq.pop();
C[M ++] = x;
if(j + 1 < N) {
pq.push({A[i] + B[j + 1], i, j + 1});
}
}
return C;
}
# | 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... |