显示代码纯文本
#include<iostream>
#include<string>
#include<algorithm>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int n;
long long a[10000],b[10000];
int sum=0;
void init()
{
cin>>n;
for(int i=1;i<=n;i++)
cin>>a[i];
}
void dfs(int m,int k)
{
if(m==n+1)return ;
int p=k^a[m];
if(p==0)
{
sum++;
b[m]=m;
cout<<sum<<endl;
for(int i=1;i<=n;i++)
if(b[i])cout<<b[i]<<' ';
cout<<endl;
exit(0);
}
else
{
sum++;
b[m]=m;
dfs(m+1,p);
sum--;
b[m]=0;
}
dfs(m+1,k);
}
int main()
{
freopen("asm_contribute.in","r",stdin);
freopen("asm_contribute.out","w",stdout);
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
init();
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
{
if(i!=j)
if(a[i]==a[j])
{
cout<<2<<endl;
cout<<i<<' '<<j<<endl;
return 0;
}
}
dfs(1,0);
return 0;
}