ID | 提交记录ID | 题目 | Hacker | Owner | 结果 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|
#138 | #196619 | #3433. Crisscross | Zeardoe | FAT | Success! | 2023-11-14 17:22:31 | 2023-11-14 17:22:32 |
详细
Extra Test:
Wrong Answer
time: 0ms
memory: 1192kb
input:
2 2 01 10
output:
1
result:
wrong answer 1st numbers differ - expected: '3', found: '1'
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#196619 | #3433. Crisscross | FAT | 97 | 31ms | 2176kb | C++11 | 645b | 2023-10-29 08:39:26 | 2023-11-14 17:22:46 |
answer
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000;
char mp[maxn + 5][maxn + 5];
int sr[maxn + 5], sc[maxn + 5];
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++) {
scanf("%s", mp[i] + 1);
for (int j = 1; j <= m; j++) sr[i] += mp[i][j] - '0';
}
for (int j = 1; j <= m; j++)
for (int i = 1; i <= n; i++) sc[j] += mp[i][j] - '0';
int ans = n + m + 1;
for (int i = 1; i <= n; i++) ans -= sr[i] == m;
for (int i = 1; i <= m; i++) ans -= sc[i] == n;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++) ans -= sr[i] == m - 1 && sc[j] == n - 1;
printf("%d", ans);
}