#include #define FOR(i,a,b) for(int (i)=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define RANGE(vec) (vec).begin(),(vec).end() using namespace std; class ArrayImplementationSimply { public: typedef unsigned long long ull; const int Block = 64; pair i2b(int idx) { return make_pair(idx/Block, idx%Block); } ull shift(const array &arry, int move) { if ( move == 0 ) return arry[1]; if ( move > 0 ) { return (arry[1]<>(Block-move)); } else { move *= -1; return (arry[1]>>move)|(arry[2]<<(Block-move)); } } void solve(void) { int N,S,X,Y,Z; int Q; cin>>N>>S>>X>>Y>>Z; cin>>Q; vector A(N/Block+1, 0); vector B(N/Block+1, 0); ull a; a = S; REP(i,N) { int p,b; tie(b,p) = i2b(i); if ( a%2 == 1 ) A[b] |= (1ULL<>S>>T>>U>>V; --S,--T,--U,--V; tie(sb,sp) = i2b(S); tie(tb,tp) = i2b(T); tie(ub,up) = i2b(U); tie(vb,vp) = i2b(V); // B=A[S,T] // A[k] = A[k] + B[k-U] (U<=k<=V) int move = up-sp; for (int k = 0, j = sb; k <= vb-ub; ++k, ++j) { array C{0,0,0}; // 一旦そのまま copy // 変換対象 block A[j] が C[1] にくるようにする。 for (int i = -1; i <= 1; ++i) { // 範囲チェック if ( sb <= i+j && i+j <= tb ) C[i+1] = A[i+j]; // 頭の不要な部分は削る if ( i+j == sb ) C[i+1] &= ~((1ULL<solve(); delete obj; return 0; } #endif