QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#130085 | #6376. LaLa and Lamp | xcyyyyy | WA | 1ms | 3740kb | C++14 | 751b | 2023-07-23 16:01:58 | 2023-07-23 16:02:01 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n;
int c[2005][2005];
int l[2005],r[2005];
int main(){
scanf("%d",&n);getchar();
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++)c[i][j]=getchar()-'0';
getchar();
}
for(int a=0;a<2;a++)for(int b=0;b<2;b++){
for(int i=1;i<=n;i++){
r[i]=(l[i]^a^c[n][i]);
l[i+1]=(r[i]^b^c[n-1][i]);
}
bool f=true;
for(int i=1;i<=n-2;i++){
int x=-1;
for(int j=1;j<=i;j++){
if(x==-1)x=(l[n-(i-j)]^r[j]^c[i][j]);
else if(x!=(l[n-(i-j)]^r[j]^c[i][j])){
f=false;
cout<<i;
break;
}
}
if(!f)break;
}
if(f)return puts("Yes"),0;
}
puts("No");
/*
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++)cout<<c[i][j];
puts("");
}
*/
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3740kb
input:
6 0 00 000 0110 00100 000000
output:
Yes
result:
ok answer is YES
Test #2:
score: 0
Accepted
time: 1ms
memory: 3416kb
input:
2 0 11
output:
Yes
result:
ok answer is YES
Test #3:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
3 1 10 011
output:
Yes
result:
ok answer is YES
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3532kb
input:
4 1 11 101 0101
output:
2222No
result:
wrong output format YES or NO expected, but 2222NO found