Submission #989754

#TimeUsernameProblemLanguageResultExecution timeMemory
989754KasymKA Plus B (IOI23_aplusb)C++17
100 / 100
64 ms10796 KiB
#include "bits/stdc++.h" #include "aplusb.h" using namespace std; #define ff first #define ss second vector<int> smallest_sums(int n, vector<int> a, vector<int> b){ set<pair<int, pair<int, int>>> s; for(int i = 0; i < n; ++i) s.insert({{a[i] + b.front()}, {i, 0}}); vector<int> ans; while((int)ans.size() != n){ auto val = *s.begin(); ans.push_back(val.ff); s.erase(val); s.insert({a[val.ss.ff] + b[val.ss.ss + 1], {val.ss.ff, val.ss.ss + 1}}); } return ans; } // int main(){ // // vector<int> kk = smallest_sums(2, {0, 2}, {1, 4}); // vector<int> kk = smallest_sums(3, {0, 2, 2}, {3, 5, 6}); // for(int i : kk) // printf("%d ", i); // return 0; // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...