QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#269607 | #6442. Secret of Tianqiu Valley | C1942huangjiaxu | WA | 0ms | 3876kb | C++14 | 606b | 2023-11-29 20:10:48 | 2023-11-29 20:10:50 |
Judging History
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)