QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#215890#6442. Secret of Tianqiu Valleyveg#WA 1ms3688kbC++14980b2023-10-15 14:14:322023-10-15 14:14:32

Judging History

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

  • [2023-10-15 14:14:32]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3688kb
  • [2023-10-15 14:14:32]
  • 提交

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;
	t[x+1] ^= 1;
	t[x+2] ^= 1;
}
void check(int A, int B) {
	memcpy(t + 1, s + 1, n);
	vector<int> ans;
	int cnt = 0;
	if (A) t[n-1]^=1,t[n]^=1,t[1]^=1, ans.push_back(n);
	if (B) t[n]^=1,t[1]^=1,t[2]^=1, ans.push_back(1);
	for (int i = 1; i <= n - 2; ++i) {
		if (!t[i]) {
			f(i);
			ans.push_back(i+1);
		}
	}
	if (!t[n-1]||!t[n]) return;
	printf("%d\n%d", ans.size(),ans[0]);
	for (int i = 1; i< ans.size(); ++i) printf(" %d", ans[i]);
	puts("");
	flag = 1;
}
int main() {
	int T;
	cin >> T;
	while (T--) {
		scanf("%d%s", &n, s + 1);
		int p = 1;
		for (int i = 1; i <= n; ++i) p &= (s[i] ^= 0x30);
		if (p) {
			puts("2\n1 1");
			continue;
		}
		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;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3688kb

input:

2
5
00000
3
001

output:

5
5 1 2 3 4
0

result:

wrong answer ignite ignited torch (test case 1)