Submission #846728

#TimeUsernameProblemLanguageResultExecution timeMemory
846728jcelinA Plus B (IOI23_aplusb)C++17
100 / 100
74 ms7668 KiB
#include <bits/stdc++.h> #include "aplusb.h" //#include<ext/pb_ds/assoc_container.hpp> //#include<ext/pb_ds/tree_policy.hpp> using namespace std; //using namespace __gnu_pbds; typedef long long ll; typedef long double ld; #define ii pair<int,int> #define pll pair<ll,ll> #define vi vector<int> #define vii vector<ii> #define vll vector<ll> #define vpll vector<pll> #define msi multiset<int> #define si set<int> #define PB push_back #define PF push_front #define PPB pop_back #define PPF pop_front #define X first #define Y second #define MP make_pair #define FOR(i, a, b) for (int i = int(a); i < int(b); i++) #define REP(i, n) FOR(i, 0, n) #define all(x) (x).begin(), (x).end() const int mod = 1e9 + 7; const int MOD = 998244353; const int inf = mod; const ll INF = 1e18; const int MAXN = 2e5 + 7; const int logo = 20; const int off = 1 << logo; const int trsz = off << 1; const int dx[] = {1, -1, 0, 0}; const int dy[] = {0, 0, 1, -1}; set<ii> s; int sm[MAXN]; vi smallest_sums(int n, vi a, vi b){ for(int i=0; i<n; i++) s.insert({a[i] + b[0], i}), sm[i] = 0; vi ret; while((int)ret.size() != n){ ii u = *s.begin(); s.erase(s.begin()); ret.PB(u.X); sm[u.Y]++; if(sm[u.Y] < n) s.insert({a[u.Y] + b[sm[u.Y]], u.Y}); } return ret; } /* void solve(){ int n; cin >> n; vi a(n), b(n); for(auto &x : a) cin >> x; for(auto &x : b) cin >> x; vi ret = smallest_sums(n, a, b); for(auto &x : ret) cout << x << " "; cout << "\n"; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t = 1; //cin >> t; while(t--) solve(); 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...