Submission #956672

#TimeUsernameProblemLanguageResultExecution timeMemory
956672ZHIRDILBILDIZCouncil (JOI23_council)C++14
16 / 100
779 ms2648 KiB
#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 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...