Submission #301202

#TimeUsernameProblemLanguageResultExecution timeMemory
301202IgorICarnival Tickets (IOI20_tickets)C++17
16 / 100
747 ms51448 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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...