# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
971841 | phoebe | A Plus B (IOI23_aplusb) | C++17 | 91 ms | 10248 KiB |
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;
#define pii pair<int, int>
vector<int> smallest_sums(int n, vector<int> a, vector<int> b){
priority_queue<pair<int, pii>> pq;
set<pii> seen;
vector<int> re;
pq.push({-(a[0] + b[0]), {0, 0}});
while (re.size() < n){
int i = pq.top().second.first, j = pq.top().second.second; pq.pop();
if (seen.count({i, j})) continue;
seen.insert({i, j});
re.push_back(a[i] + b[j]);
if (i < n - 1) pq.push({-(a[i + 1] + b[j]), {i + 1, j}});
if (j < n - 1) pq.push({-(a[i] + b[j + 1]), {i, j + 1}});
}
return re;
}
Compilation message (stderr)
# | 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... |