QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#130085#6376. LaLa and LampxcyyyyyWA 1ms3740kbC++14751b2023-07-23 16:01:582023-07-23 16:02: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-23 16:02:01]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3740kb
  • [2023-07-23 16:01:58]
  • 提交

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