Submission #973071

#TimeUsernameProblemLanguageResultExecution timeMemory
973071marinalucaA Plus B (IOI23_aplusb)C++17
100 / 100
75 ms11208 KiB
#include <bits/stdc++.h>
 
 
using namespace std;
 
 
#define ll long long
#define xx first
#define yy second
#define all (x) begin (x), end(x)
 
vector <int> smallest_sums (int n, vector <int> a, vector <int> b){
    sort (a.begin(), a.end());
    sort (b.begin(), b.end());
    set <pair<int, pair<int, int>>> s;
    vector <int> rez;
    for (int i = 0; i < n; ++ i){
        s.insert ({a[i] + b[0], {i, 0}});
    }
    for (int i = 0; i < n; ++ i){
        auto val = *s.begin();
        rez.push_back(val.xx);
        s.insert ({a[val.yy.xx] + b[val.yy.yy + 1], {val.yy.xx, val.yy.yy + 1}});
        s.erase(val);
    }
    return rez;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...