Try to get as many strings as possible, each with an even number of uppercase letters
Each string can be viewed as a length of 26 occurrences of an odd number corresponding to a position of 1 even 0
is to ask for some strings of their XOR 0
n Maximum of 24
2^24 Timeout
Can enumerate the first half N/2 so the subset exists in map
And then half the enumeration to see if there is the same XOR as it is 0
Enumerate half the time to accept
#include <cstdio> #include <cstring> #include <map> using namespace std;
const int MAXN = 30;
Map <int, int> table;
int n, A[MAXN];
int bitcount (int x) {return x = = 0? 0:bitcount (X/2) + (x&1);} int main () {char s[1000];
while (scanf ("%d", &n) = = 1 && N) {for (int i = 0; i < n; i++) {a[i] = 0;
scanf ("%s", s);
for (int j = 0; s[j]; j + +) A[i] ^= (1<< (s[j]-' a '));
} int n1 = N/2;
int n2 = N-N1;
Table.clear ();
for (int i = 0; i < (1<<N1); i++)//first half enumerates a subset of all N1 elements {int x = 0;
for (int j = 0; J < N1; J + +) {if (I & (1<<J)) x ^= a[j];
} if (!table.count (x) | | bitcount (TABLE[X]) < Bitcount (i)//bitcount the number of 1 in the 2 binary table[x] = i;
} int ans = 0;
for (int i = 0; i < (1<<N2); i++) {int x = 0;
for (int j = 0; J < N2; J + +) {if (I & (1<<J)) x ^= a[n1+j]; } if (Table.count (x) && bitcount (ans) < Bitcount (TaBLE[X]) + bitcount (i) ans = (i<<n1) ^table[x];
} printf ("%d\n", Bitcount (ans));
for (int i = 0; i < n; i++) {if (ans & (1<<i)) printf ("%d", i+1);
} printf ("\ n");
} return 0; }