# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
843675 | 2023-09-04T11:56:00 Z | PagodePaiva | A Plus B (IOI23_aplusb) | C++17 | 0 ms | 0 KB |
#include "aplusb.h" #include<bits/stdc++.h> using namespace std; std::vector<int> smallest_sums(int N, std::vector<int> A, std::vector<int> B) { priority_queue <tuple <int, int, int>> pq; pq.push_back({A[0] + B[0], 0, 0}); vector <int> ans; for(int i = 0;i < N;i++){ auto [v, l, r] = pq.top(); pq.pop(); ans.push_back(v); pq.push({A[l] + B[r+1], l, r+1}); pq.push({A[l+1]+B[r], l+1, r}); } return ans; }