// O(n^3 2^n) #include #include using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; int counton[n]; for(int i = 0; i < n; i++){ int tmp = 0; for(int j = 0; j < n; j++){ bool x; cin >> x; if(x) tmp += 1<> a[i]; int ans = accumulate(a, a+n, 0); for(int i = 0; i < 1<>j)&1) score += a[j]; } if(score >= ans) continue; int lie = i, confess = i, k = -1; while(++k < n){ if((confess>>k)&1) continue; bool judge = true; for(int l = 0; l < n; l++){ int x = (counton[k]>>l) & 1; int y = (lie>>l) & 1; judge &= x <= y; } if(judge){ confess |= 1<