제출 #1123331

#제출 시각아이디문제언어결과실행 시간메모리
1123331njoopA Plus B (IOI23_aplusb)C++17
10 / 100
0 ms328 KiB
#include <bits/stdc++.h> #define tii tuple<int, int, int> using namespace std; priority_queue<tii, vector<tii>, greater<tii>> pq; vector<int> ans; vector<int> smallest_sums(int N, vector<int> A, vector<int> B) { pq.push({A[0]+B[0], 0, 0}); while(pq.size()) { int sum = get<0>(pq.top()); int pa = get<1>(pq.top()); int pb = get<2>(pq.top()); pq.pop(); if(pa >= N || pb >= N) continue; if(ans.size() >= N) continue; ans.push_back(sum); pq.push({A[pa+1]+B[pb], pa+1, pb}); pq.push({A[pa]+B[pb+1], pa, pb+1}); } sort(ans.begin(), ans.end()); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...