QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#130055#6376. LaLa and Lamp11d10xyWA 1ms3772kbC++14947b2023-07-23 15:17:352023-07-23 15:17:38

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 15:17:38]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3772kb
  • [2023-07-23 15:17:35]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n;
char s[2010][2010];
int val[2010];
auto at=[](char tp,int p)->int&{return val[(tp-'A')*2000+p];};
auto getA=[](int x,int y)->int&{return at('A',x);};
auto getB=[](int x,int y)->int&{return at('B',y);};
auto getC=[](int x,int y)->int&{return at('C',x-y+1);};
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)
	scanf("%s",s[i]+1);
	for(int a:{0,1})for(int b:{0,1})for(int c:{0,1}){
		getA(n-1,1)=a,getA(n,1)=b,getB(n,1)=c,getC(n,1)=(s[n][1]-'0')^getA(n,1)^getB(n,1);
		for(int i=1;i<n;i++)
		getC(n-1,i)=(s[n-1][i]-'0')^getA(n-1,i)^getB(n-1,i),
		getB(n,i+1)=(s[n][i+1]-'0')^getC(n,i+1)^getA(n,i+1);
		for(int i=1;i<=n-2;i++)
		getA(i,1)=(s[i][1]-'0')^getB(i,1)^getC(i,1);
		bool good=true;
		for(int i=1;good&&i<=n;i++)
		for(int j=1;good&&j<=i;j++)
		good=good&&((s[i][j]-'0')==(getA(i,j)^getB(i,j)^getC(i,j)));
		if(good)return printf("Yes"),0;
	}printf("No");
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3772kb

input:

6
0
00
000
0110
00100
000000

output:

Yes

result:

ok answer is YES

Test #2:

score: 0
Accepted
time: 1ms
memory: 3564kb

input:

2
0
11

output:

Yes

result:

ok answer is YES

Test #3:

score: 0
Accepted
time: 1ms
memory: 3588kb

input:

3
1
10
011

output:

Yes

result:

ok answer is YES

Test #4:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

4
1
11
101
0101

output:

No

result:

ok answer is NO

Test #5:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

5
0
11
010
0011
11100

output:

No

result:

ok answer is NO

Test #6:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

6
0
10
100
1011
00001
010101

output:

No

result:

ok answer is NO

Test #7:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

7
0
01
101
0010
11000
010100
0111101

output:

No

result:

ok answer is NO

Test #8:

score: 0
Accepted
time: 1ms
memory: 3772kb

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: 3696kb

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: 3704kb

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: 3708kb

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: 3612kb

input:

12
0
01
111
0101
01110
011000
1001010
10010001
011011000
1110110101
10101101110
111100100111

output:

No

result:

wrong answer expected YES, found NO