Submission #1171752

#TimeUsernameProblemLanguageResultExecution timeMemory
1171752anteknneA Plus B (IOI23_aplusb)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define st first
#define nd second

set<pair<int, pair<int, int>>> s;
vector<int> v;

vector<int> smallest_sums(int n, vector<int> a, vector<int> b) {
    a.pb(INT_MAX/2);
    b.pb(INT_MAX/2);

    s.insert({a[0] + b[0], {0, 0}});

    for (int i = 0; i < n; i ++) {
        pair<int, pair<int, int>> x = *s.begin();
        s.erase(x);
        v.pb(x.st);
        s.insert({a[x.nd.st + 1] + b[x.nd.nd], {x.nd.st + 1, x.nd.nd}});
        s.insert({a[x.nd.st] + b[x.nd.nd + 1], {x.nd.st, x.nd.nd + 1}});
    }

    return v;
}

int main () {
     for (auto x : smallest_sums(3, {0, 2, 2}, {3, 5, 6})) {
        cout << x << " ";
     }

}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccjkFaIr.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc0u4URC.o:aplusb.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status