Submission #1095469

#TimeUsernameProblemLanguageResultExecution timeMemory
1095469_8_8_Council (JOI23_council)C++17
16 / 100
4091 ms26288 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 3e5 + 12, MOD = (int)1e9 + 7; int n, m, x[N], c[N], a[N][20], s[N]; void test() { cin >> n >> m; for(int i = 1; i <= n; i++) { for(int j = 0; j < m; j++) { cin >> a[i][j]; if(a[i][j]) { x[i] += (1 << j); c[j]++; } else { s[i] += (1 << j); } } } int val = n / 2; for(int i = 1; i <= n; i++) { int t = 0, cnt = 0; for(int j = 0; j < m; j++) { int k = c[j] - a[i][j]; if(k == val) { t += (1 << j); // cout << j << ' '; } else if(k > val) { cnt++; } } int mx = 0; for(int j = 1; j <= n; j++) { if(j == i) continue; mx = max(mx, __builtin_popcount(s[j] & t)); } cout << cnt + mx << '\n'; } } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int t = 1; // cin >> t; while(t--) test(); 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...