QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#215850#6442. Secret of Tianqiu Valleyveg#WA 0ms3948kbC++14955b2023-10-15 14:00:112023-10-15 14:00:12

Judging History

你现在查看的是最新测评结果

  • [2023-10-15 14:00:12]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3948kb
  • [2023-10-15 14:00:11]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int n;
char s[100005], t[100005];
int ans[100005], flag;
void f(int x) {
	t[x == 1 ? n : x - 1] ^= 1;
	t[x] ^= 1;
	t[x == n ? 1 : x + 1] ^= 1;
}
void check(int A, int B) {
	memcpy(t + 1, s + 1, n);
	memset(ans + 1, 0, sizeof(int) * n);
	int cnt = 0;
	if (A) f(n - 1), ans[n - 1] = 1, ++cnt;
	if (B) f(n), ans[n] = 1, ++cnt;
	for (int i = 1; i <= n - 2; ++i) {
		if (!t[i == 1 ? n : i - 1]) {
			f(i);
			ans[i] = 1;
			++cnt;
		}
	}
	for (int i = 1; i <= n; ++i) if (!t[i]) return;
	printf("%d\n", cnt);
	for (int i = 1; i <= n; ++i)
		if (ans[i]) printf("%d ", i);
	puts("");
	flag = 1;
}
int main() {
	int T;
	cin >> T;
	while (T--) {
		scanf("%d%s", &n, s + 1);
		for (int i = 1; i <= n; ++i) s[i] ^= 0x30;
		flag = 0;
		if (!flag) check(0, 0);
		if (!flag) check(1, 0);
		if (!flag) check(0, 1);
		if (!flag) check(1, 1);
		if (!flag) puts("0");
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3948kb

input:

2
5
00000
3
001

output:

5
1 2 3 4 5 
0

result:

wrong answer ignite ignited torch (test case 1)