UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#197795#3433. Crisscross1811260623197335ms2172kbC++689b2023-11-14 15:16:022023-11-14 17:29:20

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,m,x,sum[1001][1001],cnt,ans;
char a[1001][1001];
signed main()
{
    scanf("%lld %lld",&n,&m);
    for(int i=1;i<=n;i++)
    {
        cnt=0;
        scanf("\n");
        for(int j=1;j<=m;j++)
        {
            scanf("%c",&a[i][j]);
            if(a[i][j]=='0')
                cnt++;
        }
        if(cnt&&cnt!=1) 
            ans++;
    }
    for(int i=1;i<=m;i++)
    {
        cnt=0;
        for(int j=1;j<=n;j++)
        {
            if(a[j][i]=='0')
                cnt++;
        }
        if(cnt) 
            ans++;
    }
    printf("%lld",ans+1);
    return 0;
}

Details

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 0ms
memory: 1200kb

input:

4 4
1111
1011
1100
1100

output:

6

result:

ok 1 number(s): "6"

Test #2:

score: 10
Accepted
time: 0ms
memory: 1200kb

input:

1 1000
011001110110011101110110000011110011001001110111010001110001110100100010011010001001110111100...

output:

488

result:

ok 1 number(s): "488"

Test #3:

score: 10
Accepted
time: 0ms
memory: 1200kb

input:

1 1000
001110111101111001001110111111000101001110110110101100001111010001101111010100010010010001011...

output:

482

result:

ok 1 number(s): "482"

Test #4:

score: 10
Accepted
time: 42ms
memory: 2172kb

input:

1000 1000
010101000000101000010101111101010010100110110001100011110010100001010011001010110001001101...

output:

2001

result:

ok 1 number(s): "2001"

Test #5:

score: 10
Accepted
time: 42ms
memory: 2168kb

input:

1000 1000
000001101010101101101001010100001000011110100000011011010101000000000111001011010110011110...

output:

2001

result:

ok 1 number(s): "2001"

Test #6:

score: 10
Accepted
time: 37ms
memory: 2168kb

input:

1000 1000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

2001

result:

ok 1 number(s): "2001"

Test #7:

score: 10
Accepted
time: 32ms
memory: 2168kb

input:

1000 1000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

2001

result:

ok 1 number(s): "2001"

Test #8:

score: 10
Accepted
time: 55ms
memory: 2172kb

input:

1000 1000
100000010101010111000001011110000000001100000011110001110010101011110100000010011000011100...

output:

2001

result:

ok 1 number(s): "2001"

Test #9:

score: 10
Accepted
time: 62ms
memory: 2172kb

input:

1000 1000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

2001

result:

ok 1 number(s): "2001"

Test #10:

score: 10
Accepted
time: 65ms
memory: 2172kb

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: 1204kb

input:

4 3
011
011
101
101

output:

3

result:

wrong answer 1st numbers differ - expected: '7', found: '3'