QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#610872 | #6442. Secret of Tianqiu Valley | ucup-team4352# | WA | 0ms | 3624kb | C++23 | 1.1kb | 2024-10-04 17:51:12 | 2024-10-04 17:51:12 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define lowbit(x) (x&-x)
#define log(x) (31^__builtin_clz(x))
using namespace std;
int a[100005],b[100005];
int dp[100005][4];
void solve(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
char c;
cin>>c;
a[i]=c-48;
b[i]=a[i];
}
if(n==3){
int sum=0;
for(int i=1;i<=n;i++){
sum+=a[i];
}
if(sum==0)cout<<"1\n1\n";
else cout<<"0\n";
return;
}
for(int tn=0;tn<=1;tn++){
for(int t1=0;t1<=1;t1++){
for(int i=1;i<=n;i++)a[i]=b[i];
a[n-1]^=tn;
a[n]^=tn^t1;
a[1]^=tn^t1;
a[2]^=t1;
vector<int>ans;
if(tn)ans.push_back(n);
if(t1)ans.push_back(1);
for(int i=2;i<n;i++){
if(a[i-1]==0){
ans.push_back(i);
a[i-1]^=1;
a[i]^=1;
a[i+1]^=1;
}
}
if(a[n-1]+a[n]==2){
cout<<ans.size()<<"\n";
for(int i=0;i<ans.size();i++){
cout<<ans[i];
if(i+1==ans.size())cout<<"\n";
else cout<<" ";
}
return ;
}
}
}
cout<<"0\n";
}
int main(){
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int t=1;
cin>>t;
while(t--)solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3624kb
input:
2 5 00000 3 001
output:
5 5 1 2 3 4 0
result:
wrong answer ignite ignited torch (test case 1)