ID | Submission ID | Problem | Hacker | Owner | Result | Submit time | Judge time |
---|---|---|---|---|---|---|---|
#138 | #196619 | #3433. Crisscross | Zeardoe | FAT | Success! | 2023-11-14 17:22:31 | 2023-11-14 17:22:32 |
Details
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 | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#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);
}