#include #include #include #include #include using namespace std; // mod2 行列ライブラリ (bitset を使って高速化、横は SIZE 固定とする) struct BinaryMatrix { int H, W; static const int SIZE = 2010; vector< bitset > mat; BinaryMatrix(int H_, int W_) : H(H_), W(W_), mat(H_) {} // 乗算に使用 (これ微妙に転置じゃないけどなんていうんだ) BinaryMatrix T(const BinaryMatrix& A) { int h = A.H, w = A.W; BinaryMatrix res(w, h); for(int i=0; i& operator[](int k) const { return mat[k]; } bitset& operator[](int k) { return mat[k]; } }; BinaryMatrix eigen(size_t N) { BinaryMatrix res(N, N); for(size_t i=0; i0; k>>=1) { if(k & 1) res *= mat; mat *= mat; } return res; } int gaussianEliminationBinary(BinaryMatrix &mat, bool ext=false) { int N = mat.H, M = mat.W, rank = 0; for(int j=0; j+ext linearEquationBinary(BinaryMatrix A, vector b) { int N = A.H, M = A.W; BinaryMatrix mat(N, M+1); for(int i=0; i res(N); for(int i=0; i= rank and mat[i][M] == 0) return {}; } return res; } int detBinary(BinaryMatrix A) { int N = A.H; for(int j=0; j> N; BinaryMatrix mat(N, N); for(int i=0; i> c; if(c == '1') mat[i][j] = 1; } } int d = detBinary(mat); if(d == 0) cout << "Even" << endl; else cout << "Odd" << endl; } void yuki_803() { const int B = 30; int N, M, X; cin >> N >> M >> X; BinaryMatrix mat(B+M, N+1); for(int j=0; j>= 1; } for(int i=0; i> val; for(int j=0; j>= 1; } } for(int i=0; i> t >> l >> r; l--; mat[B+i][N] = t; for(int x=l; x