Submission #301021

#TimeUsernameProblemLanguageResultExecution timeMemory
301021IgorICarnival Tickets (IOI20_tickets)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;

long long find_maximum(int k, std::vector<std::vector<int>> x)
{
    int n = x.size(), m = x[0].size();
    vector<int> fr(n), to(n, m - 1);
    vector<vector<int> > ans(n, vector<int>(m, -1));
    long long res = 0;
    for (int e = 0; e < k; e++)
    {
        long long cur = 0;
        vector<pair<long long, int> > upd;
        for (int i = 0; i < n; i++)
        {
            cur -= x[i][fr[i]];
            upd.push_back({x[i][fr[i]] + x[i][to[i]], i});
        }
        sort(upd.begin(), upd.end());
        reverse(upd.begin(), upd.end());
        for (int i = 0; i < n / 2; i++)
        {
            cur += upd[i].first;
            int id = upd[i].second;
            ans[id][to[id]] = e;
            to[id]--;
        }
        for (int i = n / 2; i < n; i++)
        {
            int id = upd[i].second;
            ans[id][fr[id]] = e;
            fr[id]++;
        }
        res += cur;
    }
    allocate_tickets(ans);
    return res;
}

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:37:5: error: 'allocate_tickets' was not declared in this scope
   37 |     allocate_tickets(ans);
      |     ^~~~~~~~~~~~~~~~