QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#86812#3002. Busy BoardCharlieVinnieWA 37ms5260kbC++141.2kb2023-03-11 08:34:312023-03-11 08:34:33

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 08:34:33]
  • 评测
  • 测评结果:WA
  • 用时:37ms
  • 内存:5260kb
  • [2023-03-11 08:34:31]
  • 提交

answer

#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Rev(i,a,b) for(int i=a;i>=b;i--)
#define Fin(file) freopen(file,"r",stdin)
#define Fout(file) freopen(file,"w",stdout)
using namespace std; using ll = long long;
const int N=1e3+5;
char mp1[N][N],mp2[N][N]; int n,m,visr[N],visc[N],cntr[N],cntc[N];
int main(){
	cin>>n>>m; For(i,1,n) cin>>(mp1[i]+1);; For(i,1,n) cin>>(mp2[i]+1);
	int sm=1; For(i,1,n) For(j,1,m) if(mp1[i][j]!=mp2[i][j]) { sm=0; break; }
	if(sm) cout<<"1\n",exit(0);
	For(i,1,n) For(j,1,m) if(mp2[i][j]=='X') cntr[i]++,cntc[j]++;
	while(true){
		int ok=0;
		For(i,1,n) For(j,1,m) if( (mp2[i][j]=='X'&&cntr[i]==1&&cntc[i]==1) || (mp2[i][j]=='.'&&cntr[i]==0&&cntr[j]==0&&(!visr[i]||!visc[j])) ){
			visr[i]=visc[j]=1;
			For(k,1,m) cntr[i]-=mp2[i][k]=='X',cntc[k]-=mp2[i][k]=='X',mp2[i][k]='.';
			For(k,1,n) cntr[k]-=mp2[k][j]=='X',cntc[j]-=mp2[k][j]=='X',mp2[k][j]='.';
			ok=1;
		}
		if(!ok) break;
	}
	//~ For(i,1,n) cout<<mp2[i]+1<<'\n';
	int ok1=0; For(i,1,n) For(j,1,m) if(mp2[i][j]=='.'&&mp1[i][j]=='O') ok1=1;
	int ok2=1; For(i,1,n) For(j,1,m) if(mp2[i][j]!='.'&&mp2[i][j]!=mp1[i][j]) ok2=0;
	cout<<(ok1&ok2)<<'\n';
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 27ms
memory: 4892kb

input:

769 998
OOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOO...

output:

0

result:

ok answer is 0

Test #2:

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

input:

977 998
OOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOO...

output:

0

result:

ok answer is 0

Test #3:

score: -100
Wrong Answer
time: 37ms
memory: 5224kb

input:

941 973
XOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXOXXXXXXXOXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

0

result:

wrong answer expected 1, found 0