제출 #840421

#제출 시각아이디문제언어결과실행 시간메모리
840421grossly_overconfidentA Plus B (IOI23_aplusb)C++17
10 / 100
1 ms300 KiB
#include <bits/stdc++.h> #include "aplusb.h" using namespace std; vector<int> smallest_sums(int n, vector<int> a, vector<int> b) { priority_queue<pair<int, pair<int, int>>> pq; vector<int> out(n); set<pair<int, int>> visited; int f = 0; pq.push({a[0] + b[0], {0, 0}}); for (int i = 0; i < n; ++i){ auto h = pq.top(); pq.pop(); out[f] = h.first; f += 1; if (!visited.count({h.second.first + 1, h.second.second})){ pq.push({a[h.second.first + 1] + b[h.second.second], {h.second.first + 1, h.second.second}}); visited.insert({h.second.first + 1, h.second.second}); } if (!visited.count({h.second.first, h.second.second + 1})){ pq.push({a[h.second.first] + b[h.second.second + 1], {h.second.first, h.second.second + 1}}); visited.insert({h.second.first, h.second.second + 1}); } } return out; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...