用户输出
0
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#45717 | #1150. 1-01F.czq的疑惑矩阵 | Accepted | 100 | 4276 ms | 66020 K | C++ / 852 B | zdq | 2020-08-04 19:33:46 |
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
const int maxn = 1 << 25;
int getans(int x) {
int res = 0;
while (x) {
if (x & 1) {
res++;
}
x >>= 1;
}
return res;
}
int a[100];
int tt[maxn];
int ans = INF, tans;
int main() {
int n, m;
int t;
cin >> n >> m;
for (int i = 0; i < (1 << m); ++i) {
tt[i] = getans(i);
}
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
cin >> t;
a[i] = a[i] << 1;
a[i] |= t;
}
}
int w = 1 << m;
for (int i = 0; i < w; ++i) {
tans = 0;
for (int j = 0; j < n; ++j) {
tans += min(tt[a[j] ^ i], m - tt[a[j] ^ i]);
}
ans = min(ans, tans);
}
cout << ans;
return 0;
}
用户输出
4
系统信息
Exited with return code 0
用户输出
5
系统信息
Exited with return code 0
用户输出
5
系统信息
Exited with return code 0
用户输出
5
系统信息
Exited with return code 0
用户输出
0
系统信息
Exited with return code 0
用户输出
0
系统信息
Exited with return code 0
6 10
1 1 0 1 0 1 1 1 1 0
1 1 0 1 0 0 0 1 1 1
1 0 0 1 1 0 0 0 1 0
0 1 1 1 0 0 1 0 0 0
1 1 0 1 1 1 1 1
<25 bytes omitted>
用户输出
14
系统信息
Exited with return code 0
6 10
0 0 0 0 0 1 0 0 0 1
0 0 0 1 0 1 0 1 0 0
0 1 1 0 0 0 0 1 1 0
0 0 1 0 0 0 1 0 1 0
1 1 0 1 1 1 1 1
<25 bytes omitted>
用户输出
16
系统信息
Exited with return code 0
8 10
1 1 1 0 0 1 0 1 0 0
0 0 1 0 1 0 0 0 1 1
0 0 0 1 1 1 1 1 0 0
1 1 0 1 0 0 0 1 0 0
1 0 1 0 0 0 0 1
<65 bytes omitted>
用户输出
23
系统信息
Exited with return code 0
15 18
0 1 1 1 1 0 1 1 1 0 0 0 1 0 0 1 0 0
0 1 0 0 1 0 1 1 1 1 0 0 1 0 0 1 1 1
1 0 1 1 0 0 0 1 1 1 1
<446 bytes omitted>
用户输出
82
系统信息
Exited with return code 0
24 2
0 0
0 0
0 0
0 1
1 1
1 0
1 1
1 0
1 1
0 1
0 1
0 0
1 0
1 1
0 1
1 1
1 1
0 0
1 1
1 1
0 1
1 1
1 0
1 1
<1 byte omitted>
用户输出
9
系统信息
Exited with return code 0
19 5
1 1 1 0 1
0 0 1 1 1
1 0 1 0 1
0 1 0 0 1
1 0 1 0 1
0 0 1 1 1
1 0 0 0 0
0 1 1 0 0
0 0 0 0 1
0 0 0
<95 bytes omitted>
用户输出
27
系统信息
Exited with return code 0
19 9
0 1 1 1 0 1 1 0 0
1 0 1 0 1 0 1 1 1
0 1 1 0 1 1 1 1 1
1 0 0 0 1 0 1 1 0
1 0 1 1 0 0 1 0 1
1 1 0
<247 bytes omitted>
用户输出
51
系统信息
Exited with return code 0
21 2
0 0
0 0
1 1
1 0
0 1
1 1
0 1
0 0
1 0
0 1
0 0
0 0
1 1
0 1
1 0
0 0
0 0
0 1
0 0
0 1
1 1
用户输出
9
系统信息
Exited with return code 0
24 24
1 1 0 0 0 0 0 0 1 1 1 0 0 1 1 1 0 1 0 1 1 0 0 0
0 1 0 0 0 0 1 0 1 0 0 0 1 0 1 0 0 1 0 0 1 1 1
<1058 bytes omitted>
用户输出
207
系统信息
Exited with return code 0
24 24
0 0 0 0 0 1 0 0 0 0 1 0 1 0 1 1 1 1 0 1 1 0 1 1
0 1 0 1 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 0 1 0
<1058 bytes omitted>
用户输出
207
系统信息
Exited with return code 0
24 24
0 1 1 0 1 1 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 1 1 1
0 0 0 0 0 0 1 0 1 0 1 1 1 0 0 0 0 0 0 0 1 0 0
<1058 bytes omitted>
用户输出
203
系统信息
Exited with return code 0
24 24
0 1 0 1 1 0 1 1 1 0 0 0 0 1 0 1 0 0 1 1 0 1 1 0
1 1 1 0 1 0 0 0 0 0 1 1 1 1 1 0 1 1 1 1 0 1 0
<1058 bytes omitted>
用户输出
203
系统信息
Exited with return code 0