显示代码纯文本
//
// main.cpp
// asm_contribute
//
// Created by Qing Liu on 15/11/4.
// Copyright © 2015年 Qing Liu. All rights reserved.
//
#include <iostream>
#include <cstring>
#include <cstdio>
#define maxn 1200
using namespace std;
bool used[1200];
long long k[maxn],a[maxn];
int n;
void print(int t){
cout<<t<<endl;
for (int i=0; i<t; i++) {
cout<<k[i]<<" ";
}
}
bool DFS(int x,long long s,int t){
if (x==0) {
print(t);
return 1;
}
for (int i=s; i<n; i++) {
k[t]=n-i;
if (DFS(x^a[i], i+1, t+1)) {
return 1;
}
}
return 0;
}
int main() {
freopen("asm_contribute.in", "r", stdin);
freopen("asm_contribute.out", "w", stdout);
cin>>n;
for (int i=0; i<n; i++) {
cin>>a[n-i-1];
}
for (int i=0; i<n; i++) {
k[0]=n-i;
if (DFS(a[i], i+1, 1)) {
break;
}
}
return 0;
}