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>
#define F first
#define S second
using namespace std;
vector<int> smallest_sums(int N, vector<int> A, vector<int> B) {
vector<int>ptr(N,0);
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>pq;
for(int i = 0; i < N; i++) pq.push({A[i] + B[0],i});
int cnt = 0;
vector<int>sol;
while(cnt < N) {
sol.push_back(pq.top().F);
int i = pq.top().S;
pq.pop();
cnt++;
if(ptr[i] + 1 < N) {
ptr[i]++;
pq.push({A[i] + B[ptr[i]],i});
}
}
return sol;
}
# | 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... |