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 <bits/stdc++.h>
using namespace std;
template <class T> using v = vector<T>;
#ifdef EVAL
#define dbg(...)
#define dbg2d(...)
#else
istream &__cin = cin;
#include "../../debug.h"
__cinwrapper __cin_wrapper;
#include "../../debug.cpp"
#endif
#include "aplusb.h"
using int2 = pair<int, int>;
std::vector<int> smallest_sums(int N, std::vector<int> A, std::vector<int> B) {
v<int> ptr(N);
priority_queue<int2, v<int2>, greater<int2>> vals;
for (int i = 0; i < N; i++) {
vals.push({A[i] + B[0], i});
}
v<int> ans;
for (int i = 0; i < N; i++) {
auto [v, p] = vals.top();
vals.pop();
ans.push_back(v);
if (++ptr[p] < N) {
vals.push({A[i] + B[ptr[p]], p});
}
}
return ans;
}
# | 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... |