#include #include using namespace std; // A[n*p] * X[p*m] = B[n*m] template vector gaussian_elimination_binary(vector A, vector B, int n, int p, int m){ vector M(n); for(int i=0; i left_most(n,-1); for(int row = 0, col = p+m-1; row=m; col--){ if( ((M[row] >> col) & T(1)) == T(0)){ int pivot = row; for(int row__ = row; row__> col) & T(1)) != T(0) ){ pivot = row__; break; } } if(pivot == row) continue; swap(M[row], M[pivot]); } rank++; left_most[row] = col; for(int row__=row+1; row__> col) & T(1)) != T(0) ) M[row__] ^= M[row]; } row++; } // T = long long //T mask_B = ((T)1<=0; row--){ if( (M[row] & mask_B) != T(0) && (M[row] & mask_A) == T(0) ) has_solution = false; if(left_most[row] == -1) continue; int col = left_most[row]; for(int row__ = row-1; row__>=0; row__--){ if( ((M[row__] >> col) & T(1)) != T(0) ) M[row__] ^= M[row]; } } return has_solution? M : vector(0); } template int get_rank(vector A, int n, int m){ int rank = 0; for(int row=0, col=0; col> col)&T(1)) == T(0) ){ int pivot = row; for(int row__ = row; row__> col) & T(1)) != T(0) ){ pivot = row__; break; } } if(pivot == row) continue; swap(A[row], A[pivot]); } rank++; for(int row__=row+1; row__> col) & T(1)) != T(0) ) A[row__] ^= A[row]; } row++; } return rank; } #include int main(){ int n; cin >> n; vector d(n), w(n); for(int i=0; i> d[i]; for(int i=0; i> w[i]; vector< bitset<200> > A(n); for(int i=0; i > B(n); for(int i=0; i >(A,B, n,n,1); cout << ((v.size() == 0)?"No":"Yes") << endl; return 0; }