Submission #819899

#TimeUsernameProblemLanguageResultExecution timeMemory
819899Abrar_Al_SamitCarnival Tickets (IOI20_tickets)C++17
0 / 100
1 ms340 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; const int nax = 1500; int n, m; int cnt[nax][2]; long long find_maximum(int k, vector<vector<int>> x) { n = x.size(); m = x[0].size(); set<int>can[n]; for(int i=0; i<n; ++i) { for(int j=0; j<k; ++j) { can[i].insert(j); } } vector<vector<int>>ans(n, vector<int>(m, -1)); for(int i=0; i<n; ++i) { for(int j=0; j<m; ++j) { int done = -1; for(int at : can[i]) { if(cnt[at][x[i][j]] < n/2) { ++cnt[at][x[i][j]]; done = at; ans[i][j] = at; break; } } can[i].erase(done); } } int mx_ans = 0; for(int i=0; i<k; ++i) { mx_ans += min(cnt[i][0], cnt[i][1]); } for(int i=0; i<n; ++i) { for(int j=0; j<m; ++j) { int done = -1; for(int at : can[i]) { if(cnt[at][0] + cnt[at][1] != n) { ++cnt[at][x[i][j]]; done = at; ans[i][j] = at; break; } } can[i].erase(done); } } allocate_tickets(ans); return mx_ans; }
#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...