QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#87048#3002. Busy Boardyx20220802WA 17ms5584kbC++142.1kb2023-03-11 16:34:202023-03-11 16:34:21

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:34:21]
  • 评测
  • 测评结果:WA
  • 用时:17ms
  • 内存:5584kb
  • [2023-03-11 16:34:20]
  • 提交

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)){
					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]='?';	
					}
				}
			}
		}
	}
	fl=0;
	f(1,n,i){
		if(!vir[i])continue;
		f(1,m,j){
			if(!vic[j])continue;
			fl|=(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)puts("1");
	else puts("0");
	return 0;
}



詳細信息

Test #1:

score: 100
Accepted
time: 7ms
memory: 5176kb

input:

769 998
OOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOO...

output:

0

result:

ok answer is 0

Test #2:

score: 0
Accepted
time: 12ms
memory: 5584kb

input:

977 998
OOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOO...

output:

0

result:

ok answer is 0

Test #3:

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

input:

941 973
XOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXOXXXXXXXOXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

1

result:

ok answer is 1

Test #4:

score: -100
Wrong Answer
time: 3ms
memory: 3568kb

input:

65 983
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

0---

result:

wrong output format Expected integer, but "0---" found