QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#269607#6442. Secret of Tianqiu ValleyC1942huangjiaxuWA 0ms3876kbC++14606b2023-11-29 20:10:482023-11-29 20:10:50

Judging History

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

  • [2023-11-29 20:10:50]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3876kb
  • [2023-11-29 20:10:48]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int T,n,t[N],a[N],ca;
char s[N];
bool check(){
	for(int i=2;i<n;++i)t[i]=t[i-1]^t[i-2]^s[i-1]^49;
	if(s[0]^49^t[0]^t[1]^t[n-1]||s[n-1]^49^t[0]^t[n-2]^t[n-1])return false;
	return true;
}
void solve(){
	scanf("%d",&n);
	scanf("%s",s);
	for(t[0]=0;t[0]<2;++t[0])for(t[1]=0;t[1]<2;++t[1])if(check()){
		ca=0;
		for(int i=0;i<n;++i)if(t[i])a[++ca]=i+1;
		printf("%d\n",ca);
		for(int i=1;i<=ca;++i)printf("%d%c",a[i]," \n"[i==ca]);
		return;
	}
	puts("0");
}
int main(){
	scanf("%d",&T);
	while(T--)solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
5
00000
3
001

output:

5
1 2 3 4 5
0

result:

wrong answer ignite ignited torch (test case 1)