Submission #617320

#TimeUsernameProblemLanguageResultExecution timeMemory
617320OttoTheDinoCarnival Tickets (IOI20_tickets)C++17
25 / 100
899 ms73792 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; #define rep(i,s,e) for (int i = s; i <= e; ++i) #define fi first #define se second typedef long long ll; typedef pair<int,int> ii; typedef vector<int> vi; long long find_maximum(int k, vector<vector<int>> x) { int n = x.size(); int m = x[0].size(), cnt[n] = {}; vector<vector<int>> answer(n, vi(m)); ii vals[n*m]; rep (i,0,n-1) rep (j,0,m-1) vals[i*m+j] = {x[i][j], i}; sort(vals, vals+n*m); ll tot = 0; rep (i,0,n*m-1) { if (i<n*m/2) { tot -= vals[i].fi; cnt[vals[i].se]++; } else tot += vals[i].fi; } int id = 0; rep (i,0,n-1) { sort(x[i].begin(), x[i].end()); rep (j,0,m-1) answer[i][j] = (id+j)%m; id += cnt[i]; } allocate_tickets(answer); return tot; }
#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...