Submission #1358477

#TimeUsernameProblemLanguageResultExecution timeMemory
1358477eweirdf274rA Plus B (IOI23_aplusb)C++20
10 / 100
0 ms348 KiB
#include <bits/stdc++.h>
using namespace std;
#include "aplusb.h"

struct A{
	int i,j,x;
	bool operator<(const A&o)const{
		return x>o.x;
	}
};
priority_queue<A>pq;

std::vector<int> smallest_sums(int N, std::vector<int> A, std::vector<int> B) {
	vector<int>ret;
	pq.push({0,0,A[0]+B[0]});
	int n = A.size();
	int m = B.size();
	while(ret.size() < N){
		int i = pq.top().i,j = pq.top().j , v = pq.top().x;
		pq.pop();
		ret.push_back(v);
		if(i+1<n){
			pq.push({i+1,j,A[i+1]+B[j]});
		}
		if(j+1<m){
			pq.push({i,j+1,A[i]+B[j+1]});
		}
	}
	return ret;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...