#include typedef long long ll; typedef unsigned long long ull; #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 int uint64; std::pair i2b(int index) { return make_pair(index/64, index%64); } // // l r // 01110 01100 // [11001] 11000 uint64 shiftL(uint64 l, uint64 r, int offset) { return ((l<>(63-offset))); } // // l r // 01110 01100 // 00011 [10011] uint64 shiftR(uint64 l, uint64 r, int offset) { return ((l<<(63-offset))|(r>>offset)); } uint64 set(uint64 bit, int pos) { return (bit | (1ULL<<(63-pos))); } // pos // 11110000 uint64 all(int pos) { if (pos <= 0 || 63 < pos) return 0ULL; pos = 63-pos; return ~((1ULL<>N>>S0>>X>>Y>>Z; vector A(N/64+2,0); int Q; cin>>Q; uint64 a = S0; // 乱数生成 REP(i,N) { int j,k; tie(j,k) = i2b(i); if ( a % 2 == 1 ) A[j] = set(A[j], k); a = (a * X + Y) % Z; } // O(Q*(T-S)/64) <= 2*10^5*10^5/64 = 312500000 REP(_,Q) { int S,T,U,V; cin>>S>>T>>U>>V; --S, --T, --U, --V; int s,t,si,ti; tie(s,si) = i2b(S); tie(t,ti) = i2b(T); vector B(t-s+3,0); REP(i,t-s+1) { // 前方に詰めて copy B[i] = shiftL(A[i],A[i+1],si); if (i == t-s) // 不要な末尾部を削除 B[i] = clearR(B[i], ti-si+2); } int u,v,ui,vi; tie(u,ui) = i2b(U); tie(v,vi) = i2b(V); // add REP(i,v-u+1) { uint64 add = 0; // 後方に詰めてビットを取得 if ( i > 0) add = shiftR(B[i-1],B[i],ui); else add = shiftR(0ULL,B[i],ui); A[u+i] ^= add; } } REP(i,N) { int j,k; tie(j,k) = i2b(i); if ( A[j] & (1ULL<<(63-k)) ) cout<<"O"; else cout<<"E"; } cout<solve(); delete obj; return 0; } #endif