QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#130733 | #6376. LaLa and Lamp | Y_B_X | WA | 1ms | 5768kb | C++14 | 916b | 2023-07-24 21:55:59 | 2023-07-24 21:56:01 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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