제출 #1205696

#제출 시각아이디문제언어결과실행 시간메모리
1205696wpdmd76A Plus B (IOI23_aplusb)C++20
100 / 100
104 ms17396 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define all(v) v.begin(), v.end() #include "aplusb.h" vector<int> smallest_sums(int N, vector<int> a, vector<int> b) { vector<int> res; map<pair<ll,ll>, ll> vis; priority_queue<array<ll,3>,vector<array<ll,3>>,greater<array<ll,3>>> pq; pq.push({a[0] + b[0], 0, 0}); while(true){ auto[x, i, j] = pq.top(); pq.pop(); res.push_back(x); if(vis.find({i + 1, j}) == vis.end()) pq.push({a[i + 1] + b[j], i + 1, j}); if(vis.find({i, j + 1}) == vis.end()) pq.push({a[i] + b[j + 1], i, j + 1}); vis[{i + 1, j}] = 1; vis[{i, j + 1}] = 1; if(res.size() == N) break; } return {res}; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...