QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#87076#3002. Busy Boardyx20220802WA 20ms5512kbC++142.3kb2023-03-11 16:52:462023-03-11 16:52:47

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-11 16:52:47]
  • 评测
  • 测评结果:WA
  • 用时:20ms
  • 内存:5512kb
  • [2023-03-11 16:52:46]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
namespace IO_ER{
	#define LL long long
	#define db double
	#define ULL unsigned long long
	#define In inline
	#define f(a,b,i) for(int i=a;i<=b;i++)
	#define ff(a,b,i) for(int i=a;i<b;i++)
	#define f_(a,b,i) for(int i=a;i>=b;i--)
	#define ff_(a,b,i) for(int i=a;i>b;i--)
	typedef pair<int,int> Pi;
	int inf=0x3f3f3f3f;
	int INF=0x7fffffff;
	LL infll=0x3f3f3f3f3f3f3f3fll;
	LL INFll=0x7fffffffffffffffll;
	int FLAG_=0;
	char CHAR=0;
	template<typename T>void read(T &x){
		x=0;
		FLAG_=0;
		CHAR=getchar();
		while(CHAR<'0'||'9'<CHAR){
			if(CHAR=='-')FLAG_=1;
			CHAR=getchar();
		}
		while('0'<=CHAR&&CHAR<='9'){
			x=(x<<1)+(x<<3)+(CHAR^48);
			CHAR=getchar();
		}
		x=FLAG_?-x:x;
	}
	template<typename T,typename ...Args>void read(T &x,Args &...args){
		read(x);
		read(args...);
	}
}
using namespace IO_ER;

#define N 1050

int n,m;

int r[N];

int c[N];

char st[N][N];

char ed[N][N];

int vir[N];

int vic[N];

int main(){
//	freopen("ccc.in","r",stdin);
//	freopen("ccc.out","w",stdout);
	read(n,m);
	f(1,n,i)scanf("%s",st[i]+1);
	f(1,n,i)scanf("%s",ed[i]+1);
	int fl=1;
	f(1,n,i){
		f(1,m,j){
			if(st[i][j]!=ed[i][j]){
				fl=0;
				break;
			}
		}
		if(!fl)break;
	}
	if(fl){
		puts("1");
		return 0;		
	}
	f(1,n,i){
		f(1,m,j){
			if(ed[i][j]=='X'){
				r[i]++;
				c[j]++;
			}
		}
	}
	fl=1;
	while(fl){
		fl=0;
		f(1,n,i){
			f(1,n,j){
//				if(vir[i]&&vic[j]||ed[i][j]=='O')continue;
//				if((ed[i][j]=='X'&&r[i]==1&&c[j]==1)||(ed[i][j]=='?'&&r[i]==0&&c[j]==0)){
				if((ed[i][j]=='X'&&r[i]==1&&c[j]==1)||(ed[i][j]=='?'&&r[i]==0&&c[j]==0&&(!vir[i]||!vic[j]))){
					fl=1;
					vir[i]=1;
					vic[j]=1;
					f(1,m,k){
						r[i]-=(ed[i][k]=='X');
						c[k]-=(ed[i][k]=='X');
						ed[i][k]='?';	
					}
					f(1,n,k){
						r[k]-=(ed[k][j]=='X');
						c[j]-=(ed[k][j]=='X');
						ed[k][j]='?';	
					}
				}
			}
		}
	}
	int fll=0;
	f(1,n,i){
		if(!vir[i])continue;
		f(1,m,j){
			if(!vic[j])continue;
			fll|=(st[i][j]=='O');
		}
	}
//	if(!fl){
//		puts("0");
//		return 0;
//	}
	fl=1;
	f(1,n,i){
		f(1,m,j){
			fl&=(ed[i][j]=='?'||st[i][j]==ed[i][j]);		
		}
	}
	if(fl&fll)puts("1");
	else puts("0");
	return 0;
}



详细

Test #1:

score: 100
Accepted
time: 4ms
memory: 4980kb

input:

769 998
OOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOO...

output:

0

result:

ok answer is 0

Test #2:

score: 0
Accepted
time: 7ms
memory: 5476kb

input:

977 998
OOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOO...

output:

0

result:

ok answer is 0

Test #3:

score: 0
Accepted
time: 8ms
memory: 5260kb

input:

941 973
XOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXOXXXXXXXOXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

1

result:

ok answer is 1

Test #4:

score: 0
Accepted
time: 2ms
memory: 3532kb

input:

65 983
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

0

result:

ok answer is 0

Test #5:

score: 0
Accepted
time: 2ms
memory: 3544kb

input:

50 201
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

0

result:

ok answer is 0

Test #6:

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

input:

949 507
OXOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOXOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO...

output:

1

result:

ok answer is 1

Test #7:

score: 0
Accepted
time: 20ms
memory: 5308kb

input:

964 994
XOOOOOOOOOOOOOOOOXXXXOOXXOOOOOOOOOOOOXXOOOOXOOOOOOOOOOOXOOXOOXOOOOXOXOXOOOOOOOXOOXOOOOOOOOXOOXXOXOOOOOXOXOXOOOOOOOOOXOXOOOOOOOXXOOOOOOOOOXOOOXOXOOOOOOXXXXOOOOOOOOOOOOOOOOOXOOXOOOOOOOOOXOOOXXXOOOOOOOOOOOOXOOOOOXOXXOOOOOOOXOOOXOOOXOOOOOOOOOOXOOOOOOOXXOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOXOOOXXOXXOO...

output:

0

result:

ok answer is 0

Test #8:

score: 0
Accepted
time: 5ms
memory: 5512kb

input:

992 30
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOOOOOOOOOOOOXOOO
OOXOOOOOXOOOOOOOOOXOOOOOOOOOOO
OOOOOOXOOOOOOOOOOOOXOOOOOOOOOO
OOOOOOOOOOOOOOOOOOOXOOOOOOOOOO
OOXOOOOOOOOOOXOOOOXOOOOOOOOOOO
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOXOOOOOOOOOOOOOO
OOOOOOOOOOOOOOOOOOOOOOOOOOXOOO
OXOOOOOOOOOOOO...

output:

0

result:

ok answer is 0

Test #9:

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

input:

964 812
OOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOXOOOOOOXOOOOOOOOOOOXXOOOOOOOOOOOOOOOOOOOOOOOOOXOOOXOOOOOOOOOOXOOOOOOOOOXOOXXOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOXOOXOXOOOOOOOOOXOOOOOOOOOXOOOOOOOOOOOOOOOOOOXOOOOXOOOXOOOOOOOOOXOOOOOOO...

output:

1

result:

ok answer is 1

Test #10:

score: 0
Accepted
time: 4ms
memory: 4252kb

input:

375 970
OXOXOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOXOOOOXOOOOOOOOXOOOOOXOOOOOOOOOOOXOOOOXOOXOOOOOOOOOXOOOOOOOOOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOXXOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOXOXOOOOOOXXOXOOOOOOOOOOXOOOOOOOXOOXXOOXOXXOOXXOOOOOXXOXOOOOOOOXOOXOOOOOOOOOOOOXOXOOXOOOOOOOOOOOOOXXXOOOOOOOOOOOXOOOOOXOXOXOOOOO...

output:

0

result:

ok answer is 0

Test #11:

score: -100
Wrong Answer
time: 2ms
memory: 3764kb

input:

116 926
XXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXOXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXX...

output:

0

result:

wrong answer expected 1, found 0