UOJ Logo

NOI.AC

IDSubmission IDProblemHackerOwnerResultSubmit timeJudge time
#136#197795#3433. CrisscrossGoneend18112606231Failed.2023-11-14 17:18:232023-11-14 17:18:24

Details

Extra Test:

Invalid Input

input:

5 5
01111
10001
10001
10001
11111

output:


result:

FAIL Unexpected character #10, but ' ' expected (stdin)

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;
}