This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |