Submission #1024003

#TimeUsernameProblemLanguageResultExecution timeMemory
1024003AcanikolicA Plus B (IOI23_aplusb)C++17
100 / 100
38 ms5840 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...