ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#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;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1256kb
input:
4 4 1111 1011 1100 1100
output:
6
result:
ok 1 number(s): "6"
Test #2:
score: 10
Accepted
time: 0ms
memory: 1252kb
input:
1 1000 011001110110011101110110000011110011001001110111010001110001110100100010011010001001110111100...
output:
488
result:
ok 1 number(s): "488"
Test #3:
score: 10
Accepted
time: 0ms
memory: 1252kb
input:
1 1000 001110111101111001001110111111000101001110110110101100001111010001101111010100010010010001011...
output:
482
result:
ok 1 number(s): "482"
Test #4:
score: 10
Accepted
time: 5ms
memory: 2236kb
input:
1000 1000 010101000000101000010101111101010010100110110001100011110010100001010011001010110001001101...
output:
2001
result:
ok 1 number(s): "2001"
Test #5:
score: 10
Accepted
time: 5ms
memory: 2232kb
input:
1000 1000 000001101010101101101001010100001000011110100000011011010101000000000111001011010110011110...
output:
2001
result:
ok 1 number(s): "2001"
Test #6:
score: 10
Accepted
time: 3ms
memory: 2236kb
input:
1000 1000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
2001
result:
ok 1 number(s): "2001"
Test #7:
score: 10
Accepted
time: 3ms
memory: 2232kb
input:
1000 1000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
2001
result:
ok 1 number(s): "2001"
Test #8:
score: 10
Accepted
time: 7ms
memory: 2236kb
input:
1000 1000 100000010101010111000001011110000000001100000011110001110010101011110100000010011000011100...
output:
2001
result:
ok 1 number(s): "2001"
Test #9:
score: 10
Accepted
time: 3ms
memory: 2236kb
input:
1000 1000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
2001
result:
ok 1 number(s): "2001"
Test #10:
score: 10
Accepted
time: 0ms
memory: 2232kb
input:
1000 1000 110001000111111010010100001000100011010001001101000001001001010111010101010111111110100001...
output:
2001
result:
ok 1 number(s): "2001"
Extra Test:
score: -3
Extra Test Failed : Wrong Answer on 4
time: 0ms
memory: 1256kb
input:
4 3 011 011 101 101
output:
3
result:
wrong answer 1st numbers differ - expected: '7', found: '3'