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>
#define fi first
#define se second
#define ll long long
using namespace std;
const int N = 3e5 + 1;
int n, m;
int w[N];
int cnt[20];
signed main () {
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> n >> m;
for (int i = 1; i <= n; ++i)
for (int j = 0; j < m; ++j) {
int x;
cin >> x;
w[i] ^= (1 << j) * x;
cnt[j] += x;
}
if (n <= 3000) {
for (int i = 1; i <= n; ++i) {
int ans = 0;
for (int q = 0; q < m ; ++q)
if ((1 << q) & w[i])
--cnt[q];
// cout << "i = " << i << '\n';
// for (int j = 0; j < m; ++j)
// cout << cnt[j] << ' ';
// cout << '\n';
for (int j = 1; j <= n; ++j) {
if (i == j)
continue;
int now = 0;
for (int q = 0; q < m ; ++q)
if (((1 << q) & w[j])) {
if((cnt[q] - 1) >= n >> 1)
++now;
} else {
if(cnt[q] >= n >> 1)
++now;
}
ans = max(ans, now);
}
for (int q = 0; q < m ; ++q)
if ((1 << q) & w[i])
++cnt[q];
cout << ans << '\n';
}
return 0;
}
if (m <= 10) {
return 0;
}
return 0;
}
# | 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... |