ID | Submission ID | Problem | Hacker | Owner | Result | Submit time | Judge time |
---|---|---|---|---|---|---|---|
#139 | #196991 | #3433. Crisscross | Goneend | shiziping | Failed. | 2023-11-14 17:27:23 | 2023-11-14 17:27:23 |
Details
Extra Test:
Accepted
time: 0ms
memory: 1256kb
input:
4 3 100 100 010 010
output:
8
result:
ok 1 number(s): "8"
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#196991 | #3433. Crisscross | shiziping | 97 | 26ms | 2236kb | C++11 | 817b | 2023-11-04 15:55:48 | 2023-11-14 17:29:13 |
answer
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define mp(Tx, Ty) make_pair(Tx, Ty)
#define For(Ti, Ta, Tb) for(auto Ti = (Ta); Ti <= (Tb); Ti++)
#define Dec(Ti, Ta, Tb) for(auto Ti = (Ta); Ti >= (Tb); Ti--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define range(Tx) begin(Tx),end(Tx)
const int N = 1005;
char a[N][N];
int n, m;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
cin >> n >> m;
For(i, 1, n) cin >> a[i] + 1;
long long ans = 1;
For(i, 1, n) {
int cnt = 0;
For(j, 1, m) {
cnt += (a[i][j] == '0');
}
if (cnt == 0) continue;
if (cnt == 1) continue;
ans++;
}
For(j, 1, m) {
int cnt = 0;
For(i, 1, n) {
cnt += (a[i][j] == '0');
}
if (cnt == 0) continue;
ans++;
}
cout << ans;
return 0;
}