UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#197819#3433. Crisscrossstd100272ms9032kbC++1.2kb2023-11-14 17:21:022023-11-14 17:29:28

answer

// what is matter? never mind.
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2")
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
#define ull unsigned long long
//#define int long long
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define maxn 200005
#define inf 0x3f3f3f3f

int n,m,res;
int a[2005][2005],deg[maxn];
char str[maxn];

signed main()
{
//	freopen("a9.in","r",stdin);
//	freopen("a9.out","w",stdout);
	n=read(),m=read();
	For(i,1,n){
		cin>>str;
		For(j,1,m){
			a[i][j]=(str[j-1]&1);
			if(!a[i][j])deg[i]++,deg[j+n]++;
		}
	}
	int nn=n,mm=m;
	For(i,1,n) if(!deg[i]) --nn;
	For(i,n+1,n+m) if(!deg[i]) --mm;
	int res=nn+mm+1;
	For(i,1,n)
		if(deg[i]==1){
			int v=0;
			For(j,1,m) if(!a[i][j]) v=j;
			if(deg[v+n]==1) --res;
		}
	cout<<res;
	return 0;
}
/*

*/

这程序好像有点Bug,我给组数据试试?

详细

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

Test #1:

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

input:

4 4
1111
1011
1100
1100

output:

6

result:

ok 1 number(s): "6"

Test #2:

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

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: 46ms
memory: 9028kb

input:

1000 1000
010101000000101000010101111101010010100110110001100011110010100001010011001010110001001101...

output:

2001

result:

ok 1 number(s): "2001"

Test #5:

score: 10
Accepted
time: 35ms
memory: 9028kb

input:

1000 1000
000001101010101101101001010100001000011110100000011011010101000000000111001011010110011110...

output:

2001

result:

ok 1 number(s): "2001"

Test #6:

score: 10
Accepted
time: 25ms
memory: 9032kb

input:

1000 1000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

2001

result:

ok 1 number(s): "2001"

Test #7:

score: 10
Accepted
time: 27ms
memory: 9032kb

input:

1000 1000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

2001

result:

ok 1 number(s): "2001"

Test #8:

score: 10
Accepted
time: 36ms
memory: 9028kb

input:

1000 1000
100000010101010111000001011110000000001100000011110001110010101011110100000010011000011100...

output:

2001

result:

ok 1 number(s): "2001"

Test #9:

score: 10
Accepted
time: 43ms
memory: 9032kb

input:

1000 1000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

2001

result:

ok 1 number(s): "2001"

Test #10:

score: 10
Accepted
time: 60ms
memory: 9032kb

input:

1000 1000
110001000111111010010100001000100011010001001101000001001001010111010101010111111110100001...

output:

2001

result:

ok 1 number(s): "2001"

Extra Test:

score: 0
Extra Test Passed