Submission #616050

#TimeUsernameProblemLanguageResultExecution timeMemory
616050yanndevCarnival Tickets (IOI20_tickets)C++17
27 / 100
465 ms73084 KiB
#include "tickets.h" #include <bits/stdc++.h> #define ll long long #define fi first #define se second using namespace std; ll find_maximum(int k, vector<vector<int>> x) { int n = x.size(); int m = x[0].size(); if (m == 1) { vector<vector<int>> answer; vector<int> vals {}; ll score = 0; for (int i = 0; i < n; i++) { vector<int> row (m); for (int j = 0; j < m; j++) { vals.push_back(x[i][j]); if (j < k) { row[j] = j; } else { row[j] = -1; } } answer.push_back(row); } sort(vals.begin(), vals.end()); for (auto& x: vals) score += (ll)abs(x - vals[n / 2]); allocate_tickets(answer); return score; } if (k == 1) { vector<vector<int>> ans (n, vector<int> (m, -1)); vector<pair<int, int>> op {}; ll score = 0; for (int i = 0; i < n; i++) { ans[i][m - 1] = 0; score += x[i][m - 1]; op.push_back({-(x[i][m - 1] + x[i][0]), i}); } sort(op.begin(), op.end()); reverse(op.begin(), op.end()); for (int i = 0; i < n / 2; i++) { score += op[i].fi; ans[op[i].se][m - 1] = -1; ans[op[i].se][0] = 0; } allocate_tickets(ans); return score; } return 0; }
#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...