QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#86822#3002. Busy Boardfzj2007WA 12ms11332kbC++142.4kb2023-03-11 09:25:282023-03-11 09:25:31

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 09:25:31]
  • 评测
  • 测评结果:WA
  • 用时:12ms
  • 内存:11332kb
  • [2023-03-11 09:25:28]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
namespace IO{
	template<typename T>inline bool read(T &x){
		x=0;
		char ch=getchar();
		bool flag=0,ret=0;
		while(ch<'0'||ch>'9') flag=flag||(ch=='-'),ch=getchar();
		while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar(),ret=1;
		x=flag?-x:x;
        return ret;
	}
	template<typename T,typename ...Args>inline bool read(T& a,Args& ...args){
	    return read(a)&&read(args...);
	}
	template<typename T>void prt(T x){
		if(x>9) prt(x/10);
		putchar(x%10+'0');
	}
	template<typename T>inline void put(T x){
		if(x<0) putchar('-'),x=-x;
		prt(x);
	}
	template<typename T>inline void put(char ch,T x){
		if(x<0) putchar('-'),x=-x;
		prt(x);
		putchar(ch);
	}
	template<typename T,typename ...Args>inline void put(T a,Args ...args){
	    put(a);
		put(args...);
	}
	template<typename T,typename ...Args>inline void put(const char ch,T a,Args ...args){
	    put(ch,a);
		put(ch,args...);
	}
	inline void put(string s){
		for(int i=0,sz=s.length();i<sz;i++) putchar(s[i]);
	}
	inline void put(const char* s){
		for(int i=0,sz=strlen(s);i<sz;i++) putchar(s[i]);
	}
	inline bool getch(){
		char ch=getchar();
		while(ch!='O'&&ch!='X') ch=getchar();
		return ch=='X';
	}
}
using namespace IO;
#define N 1005
int n,m,A[N][N],B[N][N],L[N][3],R[N][3]; 
bool vis[N<<1],flag;
int main(){
	read(n,m);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++) A[i][j]=getch();
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++) B[i][j]=getch(),L[i][B[i][j]]++,R[i][B[i][j]]++;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++) flag=flag&&A[i][j]==B[i][j];
	if(flag) return puts("1"),0;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++) flag=flag||!A[i][j];
	if(!flag) return puts("0"),0; 
	do{
		flag=0;
		for(int x=1;x<=n;x++){
			for(int y=1;y<=m;y++){
				if((vis[x]&&vis[y+n])||!B[x][y]) continue;
				if((L[x][1]==1&&R[y][1]==1&&B[x][y]==1)||(L[x][1]==0&&R[y][1]==0&&B[x][y]==2)){
					vis[x]=vis[y+n]=flag=1;
					for(int i=1;i<=m;i++){
						L[x][B[x][i]]--,R[i][B[x][i]]--;
						B[x][i]=2;
						L[x][B[x][i]]++,R[i][B[x][i]]++;
					}
					for(int i=1;i<=n;i++){
						R[y][B[i][y]]--,L[i][B[i][y]]--;
						B[i][y]=2;
						R[y][B[i][y]]++,L[i][B[i][y]]++;
					}
				}
			}
		}
	}while(flag);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			if(B[i][j]!=2&&B[i][j]!=A[i][j]) return puts("0"),0;
	puts("1");
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 12ms
memory: 10440kb

input:

769 998
OOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOO...

output:

0

result:

ok answer is 0

Test #2:

score: 0
Accepted
time: 1ms
memory: 11332kb

input:

977 998
OOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOO...

output:

0

result:

ok answer is 0

Test #3:

score: -100
Wrong Answer
time: 5ms
memory: 11008kb

input:

941 973
XOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXOXXXXXXXOXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

0

result:

wrong answer expected 1, found 0