Submission #902390

#TimeUsernameProblemLanguageResultExecution timeMemory
902390KK_1729A Plus B (IOI23_aplusb)C++17
100 / 100
78 ms9644 KiB
#include "aplusb.h" #include <bits/stdc++.h> using namespace std; // #define int long long #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define pb push_back #define all(a) a.begin(), a.end() #define endl "\n" void printVector(vector<int> a){ for (auto x: a) cout << x << " "; cout << endl; } vector<int> smallest_sums(int N, vector<int> A, vector<int> B) { vector<int> ans; multiset<pair<int, int>> o; vector<int> l(N+1); FOR(i,0,N) o.insert({A[i]+B[0], i}); FOR(h,0,N){ pair<int, int> x = *o.begin(); ans.pb(x.first); o.erase(x); l[x.second]++; if (l[x.second] < N){ o.insert({A[x.second]+B[l[x.second]], x.second}); } } sort(all(ans)); 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...