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 <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5+5;
const int MAXM = 25;
bool votes[MAXN][MAXM];
int vsum[MAXM];
int n, m;
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
cin >> n >> m;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> votes[i][j];
vsum[j] += votes[i][j];
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) vsum[j] -= votes[i][j];
int mx = 0;
for (int k = 0; k < n; k++) {
if (k == i) continue;
int num = 0;
for (int j = 0; j < m; j++) {
num += (vsum[j]-votes[k][j] >= n/2);
}
mx = max(mx, num);
}
for (int j = 0; j < m; j++) vsum[j] += votes[i][j];
cout << mx << '\n';
}
}
# | 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... |