Submission #301200

#TimeUsernameProblemLanguageResultExecution timeMemory
301200IgorICarnival Tickets (IOI20_tickets)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //#include "tickets.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<vector<int> > ans(n, vector<int>(m, -1)); vector<pair<long long, pair<int, int> > > moo; long long res = 0; for (int e = 0; e < k; e++) { for (int i = 0; i < n; i++) { ans[i][e] = e; res -= x[i][e]; moo.push_back({x[i][e] + x[i][e + m - k], {i, e}}); } } sort(moo.begin(), moo.end()); reverse(moo.begin(), moo.end()); for (int i = 0; i < n / 2 * k; i++) { int a = moo[i].second.first; int b = moo[i].second.second; res += moo[i].first; ans[a][b + m - k] = ans[a][b]; ans[a][b] = -1; } //allocate_tickets(ans); return res; } int main() { int n, m, k; cin >> n >> m >> k; vector<vector<int> > x(n, vector<int>(m)); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> x[i][j]; } } cout << find_maximum(k, x); }

Compilation message (stderr)

/tmp/ccTt03r3.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccr1yVF4.o:tickets.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status