QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#130184 | #6376. LaLa and Lamp | kkio | WA | 1ms | 5812kb | C++14 | 1.1kb | 2023-07-23 17:31:50 | 2023-07-23 17:31:52 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int maxn=2005;
int a[maxn],b[maxn],c[maxn],s[maxn][maxn],n;
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
for(int j=1;j<=i;j++)
scanf("%1d",&s[i][j]);
for(a[n]=0;a[n]<=1;a[n]++)
for(a[n-1]=0;a[n-1]<=1;a[n-1]++)
for(b[1]=0;b[1]<=1;b[1]++)
{
c[1]=s[n][1]^a[n]^b[1];
for(int i=2;i<=n;i++)
c[i]=s[n-1][i-1]^b[i-1]^a[n-1],b[i]=a[n]^c[i]^s[n][i];
bool ok=1;
for(int i=n-3;i>=1;i--)
{
int flag=0;
for(int j=1;j<=n;j++)
{
int v=s[i][j]^c[n-i+j]^b[j];
if(v)flag|=2;
else flag|=1;
}
if(flag==3){ok=0;break;}
}
if(ok){
puts("Yes");
return 0;
}
}
puts("No");
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5812kb
input:
6 0 00 000 0110 00100 000000
output:
No
result:
wrong answer expected YES, found NO