Submission #973070

#TimeUsernameProblemLanguageResultExecution timeMemory
973070marinalucaA Plus B (IOI23_aplusb)C++17
10 / 100
1 ms348 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[i], {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...