#include<bits/stdc++.h> #define N 210 usingnamespace std;
bitset<N> matrix[N]; bitset<N> ans; int n;
voidout(){ cerr << "-----------------" << endl; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n + 1; j++) { cerr << setw(5) << matrix[i][j]; } cerr << endl; } cerr << "-----------------" << endl; }
intgauss(){ int rank = 0; for (int c = 1, r = 1; c <= n; c++) { int t = r; for (int i = r; i <= n; i++) { if (matrix[i].test(c)) { t = i; break; } } if (!matrix[t].test(c)) continue; if (t ^ r) swap(matrix[r], matrix[t]);
for (int i = 1; i <= n; i++) { if (matrix[i].test(c) && i ^ r) { matrix[i] ^= matrix[r]; } } r++; rank++; } if (rank < n) { for (int i = rank + 1; i <= n; i++) { if (matrix[i].test(n + 1)) return0; } for (int i = 1; i <= n; i++) { for (int j = 1; j <= n + 1; j++) { if (matrix[i].test(j)) { ans[j] = matrix[i][n + 1]; break; } } } return1; } for (int i = 1; i <= n; i++) ans[i] = matrix[i][n + 1]; return2; }