QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#130181 | #6376. LaLa and Lamp | kkio | WA | 1ms | 5612kb | C++14 | 1.1kb | 2023-07-23 17:30:09 | 2023-07-23 17:30:11 |
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[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: 100
Accepted
time: 1ms
memory: 3424kb
input:
6 0 00 000 0110 00100 000000
output:
Yes
result:
ok answer is YES
Test #2:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
2 0 11
output:
Yes
result:
ok answer is YES
Test #3:
score: 0
Accepted
time: 1ms
memory: 3428kb
input:
3 1 10 011
output:
Yes
result:
ok answer is YES
Test #4:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
4 1 11 101 0101
output:
No
result:
ok answer is NO
Test #5:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
5 0 11 010 0011 11100
output:
No
result:
ok answer is NO
Test #6:
score: 0
Accepted
time: 0ms
memory: 5612kb
input:
6 0 10 100 1011 00001 010101
output:
No
result:
ok answer is NO
Test #7:
score: 0
Accepted
time: 1ms
memory: 3748kb
input:
7 0 01 101 0010 11000 010100 0111101
output:
No
result:
ok answer is NO
Test #8:
score: 0
Accepted
time: 1ms
memory: 3500kb
input:
8 0 01 100 1111 10011 001010 1000010 00001101
output:
No
result:
ok answer is NO
Test #9:
score: 0
Accepted
time: 1ms
memory: 3496kb
input:
9 1 00 111 0000 11110 100011 0100101 01010001 010111101
output:
No
result:
ok answer is NO
Test #10:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
10 1 01 011 1101 01011 000111 1111000 11111111 000010010 0011001100
output:
No
result:
ok answer is NO
Test #11:
score: 0
Accepted
time: 1ms
memory: 3764kb
input:
11 1 11 001 0001 00011 111000 1101001 10100101 100111110 1000001011 11110011111
output:
No
result:
ok answer is NO
Test #12:
score: -100
Wrong Answer
time: 0ms
memory: 3816kb
input:
12 0 01 111 0101 01110 011000 1001010 10010001 011011000 1110110101 10101101110 111100100111
output:
No
result:
wrong answer expected YES, found NO