#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) typedef long long ll; const int MAX_COL=51;//適宜. struct bitMatrix{ int h,w; vector> val; bitMatrix(int m=1,int n=1):h(m),w(n){ val.resize(m); } inline bitset& operator[](const int i){return val[i];} }; int bit_Gauss_Jordan(bitMatrix &a,bool is_ex=false){ int rank=0; for(int col=0;col b,vector &res){ int m=A.h; int n=A.w; bitMatrix M(m,n+1); for(int i=0;i> N >> M; assert(1<=N<=50); assert(1<=M<=10000); bitMatrix B(M,N); vector Y(M); for(int i=0;i> A; assert(1<=A<=N); int last=-1; for(int j=0;j> b; assert(1<=b<=N); assert(last> Y[i]; assert(0<=Y[i]<(1<<30)); } bool ok=true; vector ans(N); vector res; vector b(M); for(int i=0;i<30;i++){ for(int j=0;j>i)&1); int rank=bit_linear_equation(B,b,res); if(rank==-1){ ok=false; break; } for(int j=0;j