#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define st first
#define nd second
set<pair<int, pair<int, int>>> s;
vector<int> v;
vector<int> smallest_sums(int n, vector<int> a, vector<int> b) {
a.pb(INT_MAX/2);
b.pb(INT_MAX/2);
s.insert({a[0] + b[0], {0, 0}});
for (int i = 0; i < n; i ++) {
pair<int, pair<int, int>> x = *s.begin();
s.erase(x);
v.pb(x.st);
s.insert({a[x.nd.st + 1] + b[x.nd.nd], {x.nd.st + 1, x.nd.nd}});
s.insert({a[x.nd.st] + b[x.nd.nd + 1], {x.nd.st, x.nd.nd + 1}});
}
return v;
}
# | 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... |