Submission #300770

#TimeUsernameProblemLanguageResultExecution timeMemory
300770IgorICarnival Tickets (IOI20_tickets)C++17
27 / 100
820 ms51484 KiB
#include "tickets.h" #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<pair<long long, int> > improve; vector<vector<int> > ans(n, vector<int>(m, -1)); long long si = 0; for (int i = 0; i < n; i++) { si -= x[i][0]; improve.push_back({x[i][0] + x[i][m - 1], i}); } sort(improve.begin(), improve.end()); reverse(improve.begin(), improve.end()); for (int i = 0; i < n / 2; i++) { ans[improve[i].second][m - 1] = 0; si += improve[i].first; } for (int i = n / 2; i < n; i++) { ans[improve[i].second][0] = 0; } allocate_tickets(ans); return si; }
#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...