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 int long long
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define pb push_back
#define all(a) a.begin(), a.end()
#define endl "\n"
void printVector(vector<int> a){
for (auto x: a) cout << x << " ";
cout << endl;
}
vector<int> smallest_sums(int N, vector<int> A, vector<int> B) {
vector<int> ans;
multiset<pair<int, int>> o;
vector<int> l(N+1);
FOR(i,0,N) o.insert({A[i]+B[0], i});
FOR(h,0,N){
pair<int, int> x = *o.begin();
ans.pb(x.first);
o.erase(x);
l[x.second]++;
if (l[x.second] < N){
o.insert({A[x.second]+B[l[x.second]], x.second});
}
}
sort(all(ans));
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... |