QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#610872#6442. Secret of Tianqiu Valleyucup-team4352#WA 0ms3624kbC++231.1kb2024-10-04 17:51:122024-10-04 17:51:12

Judging History

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

  • [2024-10-04 17:51:12]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3624kb
  • [2024-10-04 17:51:12]
  • 提交

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();
}

详细

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)