QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#130135#6376. LaLa and Lampsinsop90WA 1ms5832kbC++14790b2023-07-23 17:06:222023-07-23 17:06:24

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 17:06:24]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5832kb
  • [2023-07-23 17:06:22]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int maxn = 3005;
int n, p[3][maxn], a[maxn][maxn];
char s[maxn][maxn];
int main() {
	scanf("%d", &n);
	for(int i = 1;i <= n;i++) scanf("%d", &s[i] + 1);
	for(int i = 0;i <= 7;i++) {
		p[0][1] = (i & 1), p[0][2] = (i >> 1) & 1, p[1][1] = (i >> 2) & 1;
		for(int j = 1;j <= n + n - 1;j++) {
			if(j & 1) p[2][(j + 1) / 2] = p[0][1] ^ (s[n][(j + 1) / 2] - '0') ^ p[1][(j + 1) / 2];
			else p[1][j / 2 + 1] = p[0][2] ^ (s[n - 1][j / 2] - '0') ^ p[2][j / 2];  
		}
		int flag = 1;
		for(int j = 1;j <= n - 2;j++) {
			int res = 0;
			for(int k = 1;k <= j;k++) a[j][k] = (s[j][k] - '0') ^ p[1][n - j + 1] ^ p[2][k], res += a[j][k];
			if(res && res != j) flag = 0;
		}
		if(flag) return puts("Yes"), 0;
	} 
	puts("No");
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

6
0
00
000
0110
00100
000000

output:

Yes

result:

ok answer is YES

Test #2:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

2
0
11

output:

Yes

result:

ok answer is YES

Test #3:

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

input:

3
1
10
011

output:

Yes

result:

ok answer is YES

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 5832kb

input:

4
1
11
101
0101

output:

Yes

result:

wrong answer expected NO, found YES