int sve[MAXN]= {0}, m = 0; voidwork(){ int lim = (1 << M) - 1; for (int state = 0; state <= lim; state ++) { int cnt = __builtin_popcount (state); if (cnt == (M >> 1)) sve[++ m] = state; } }
inlineintgetnum(){ int num = 0; char ch = getchar (); while (! isdigit (ch)) ch = getchar (); while (isdigit (ch)) num = (num << 3) + (num << 1) + ch - '0', ch = getchar (); return num; }
intmain(){ N = getnum (), M = getnum (); if (M > 14) M = 14; work (); for (int i = 2; i <= N; i ++) { scanf ("%s", in + 1); for (int j = 1; j < i; j ++) { for (int k = 0; k < M; k ++) { if (in[j] == '1' && ((sve[i] >> k) & 1) == 1 && ((sve[j] >> k) & 1) == 0) { putchar (k + 'a'); break; } if (in[j] == '0' && ((sve[i] >> k) & 1) == 0 && ((sve[j] >> k) & 1) == 1) { putchar (k + 'a'); break; } } } puts (""); }