#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(ull arry[3], int move) { if ( move == 0 ) return arry[1]; if ( move > 0 ) { return (arry[1]<>(Block-1-move)); } else { move *= -1; return (arry[1]>>move)|(arry[2]<<(Block-1-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 ) 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) { ull C[3] = {0,0,0}; // 一旦そのまま copy // 対象 block が C[1] にくるようにする。 for (int i = -1; i <= 1; ++i) { if ( 0 <= sb+i && sb+i < (int)A.size() ) C[i+1] = A[sb+i]; } if ( j == sb ) { // 頭の不要な部分は削る C[0] = 0; C[1] = C[1] & ~((1ULL<solve(); delete obj; return 0; } #endif