이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 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... |