QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#130733#6376. LaLa and LampY_B_XWA 1ms5768kbC++14916b2023-07-24 21:55:592023-07-24 21:56:01

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-24 21:56:01]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5768kb
  • [2023-07-24 21:55:59]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=2010;
int n;
bool a[N][N],b[N][N],flag=0;
bool x[N],y[N];
#define f2(_) for(_=0;_<=1;++_)
#define YES return puts("Yes"),0
template<typename T>
inline void pr(T &a){
	for(int i=1;i<=n;++i){
		printf("	");
		for(int j=1;j<=i;++j){
			printf("%d",a[i][j]);
		}
		puts("");
	}
}
bool solve(bool zn,bool zn_,bool yn){
	y[n]=yn;int i,j;
	for(i=n;i;--i){
		x[i]=a[n][i]^y[i]^zn;
		y[i-1]=a[n-1][i-1]^x[i]^zn_;
	}
	for(i=1;i<=n;++i)for(j=1;j<=i;++j){
		b[n-i+j][j]=x[i]^y[j]^a[n-i+j][j];
	}
	bool bi;
	for(i=1;i<=n;++i){
		bi=b[i][1];
		for(j=2;j<=i;++j)if(b[i][j]!=bi)return 0; 
	}
	return 1;
}
int main(){
	int i,j;char ch;
	scanf("%d",&n);
	for(i=1;i<=n;++i){
		while(ch<48)ch=getchar();
		for(j=1;j<=i;++j)a[i][j]=ch^48,ch=getchar();
	}
	int _,__,___;
	f2(_)f2(__)f2(___)if(solve(_,__,___))YES;
	return puts("No"),0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5768kb

input:

6
0
00
000
0110
00100
000000

output:

No

result:

wrong answer expected YES, found NO