Submission #1282097

#TimeUsernameProblemLanguageResultExecution timeMemory
1282097lukasuliashviliFestival (IOI25_festival)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

vector<int> max_coupons(long long A, vector<long long>& P, vector<int>& T) {
    int N = (int)P.size();
    vector<int> idx(N);
    iota(idx.begin(), idx.end(), 0);
    sort(idx.begin(), idx.end(), [&](int i, int j){
        if (P[i] != P[j]) return P[i] < P[j];
        return T[i] > T[j];
    });
    long long tokens = A;
    vector<bool> used(N,false);
    vector<int> result;
    int pos = 0;
    priority_queue<pair<int,int>> pq;
    while (true) {
        while (pos < N && P[idx[pos]] <= tokens) {
            int i = idx[pos];
            pq.emplace(T[i], i);
            pos++;
        }
        if (pq.empty()) break;
        auto [mult, i] = pq.top();
        pq.pop();
        if (used[i]) continue;
        used[i] = true;
        result.push_back(i);
        tokens = (tokens - P[i]) * mult;
    }
    return result;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccz27FpG.o: in function `main':
grader.cpp:(.text.startup+0x22a): undefined reference to `max_coupons(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status