Submission #1131135

#TimeUsernameProblemLanguageResultExecution timeMemory
1131135belgianbotA Plus B (IOI23_aplusb)C++17
100 / 100
62 ms7668 KiB
#include "aplusb.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> smallest_sums(int N, vector<int> A, vector<int> B) {
	
	vector<int> small(N);
	int cnt = 0;
	
	priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;
	for (int i = 0; i < N; i++) {
		q.push({A[i]+B[0], i, 0});
	}
	while (cnt < N) {
		vector<int> c = q.top(); q.pop();
		int x = c[0], y = c[1], z = c[2];
		small[cnt] = x;
		cnt++;
		if (z < N - 1) q.push({A[y] + B[z + 1], y, z + 1});
	}
	
	return small;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...