Submission #366936

#TimeUsernameProblemLanguageResultExecution timeMemory
366936wind_reaperCarnival Tickets (IOI20_tickets)C++17
0 / 100
1 ms364 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; long long find_maximum(int k, vector<vector<int>> x) { int n = x.size(); int m = x[0].size(); vector<vector<int>> ans(n, vector<int>(m, -1)); int64_t a = 0; for(int i = 0; i < n; i++){ for(int j = m-1; j >= m-k; --j){ ans[i][j] = (m-1-j); a += int64_t(x[i][j]); } } vector<array<int64_t, 4>> b; for(int i = 0; i < n; i++){ for(int j = 1; j <= k; j++) b.push_back({x[i][k-j] + x[i][m-j], i, k-j, m-j}); } sort(b.rbegin(), b.rend()); for(int i = 0; i < (n*k)/2; i++){ int64_t red = b[i][0]; int row = b[i][1], mn = b[i][2], mx = b[i][3]; a -= red; swap(ans[row][mx], ans[row][mn]); } allocate_tickets(ans); return a; }
#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...