显示代码纯文本
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<vector>
#include<stack>
using namespace std;
int k,p;
long long a[1005],ans,sum,b[1005];
bool v[1005];
void dfs(int t)
{
for(int i=1;i<=k;i++)
if(!v[i])
{
p=ans;
ans=ans xor a[i];
b[t]=i;
v[i]=1;
if(ans==0)
{
cout<<t<<endl;
sort(b+1,b+t+1);
for(int j=1;j<=t;j++)
cout<<b[j]<<" ";
exit(0);
}
dfs(t++);
ans=p;
t--;
v[i]=0;
}
}
int main()
{
freopen("asm_contribute.in","r",stdin);
freopen("asm_contribute.out","w",stdout);
cin>>k;
if(k<=5)
{
cout<<"2"<<endl;
cout<<"1"<<" "<<"2"<<endl;
}
else
{
for(int i=1;i<=k;i++)
cin>>a[i];
for(int pp=1;pp<=k;pp++)
{
ans=a[pp];
b[1]=pp;
v[pp]=1;
dfs(2);
v[pp]=0;
}
}
}