Submission #565814

#TimeUsernameProblemLanguageResultExecution timeMemory
565814sidonCarnival Tickets (IOI20_tickets)C++17
27 / 100
501 ms73100 KiB
#include "tickets.h" #include "bits/stdc++.h" using namespace std; using ll = long long; ll find_maximum(int k, vector<vector<int>> x) { int n = x.size(), m = x[0].size(); vector<vector<int>> g(n, vector<int> (m, -1)); ll res {}; if(k < 2) { array<ll, 2> a[n] {}; for(int i = n; i--; ) { res -= x[i][0]; a[i] = {x[i][0] + x[i][m-1], i}; } sort(a, a + n); for(int i = n/2; i < n; ++i) g[a[i][1]][m-1] = 0, res += a[i][0]; for(int i = n/2; i--; ) g[a[i][1]][0] = 0; } else { assert(0); } allocate_tickets(g); 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...