結果

問題 No.142 単なる配列の操作に関する実装問題
ユーザー 👑 kmjpkmjp
提出日時 2015-02-02 00:05:24
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,346 bytes
コンパイル時間 1,090 ms
コンパイル使用メモリ 146,928 KB
実行使用メモリ 19,492 KB
最終ジャッジ日時 2023-09-05 09:58:50
合計ジャッジ時間 8,153 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<to;x++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll N,S,X,Y,Z,T,U,V;
int Q;
ll A[2020000];
ll C[80000];
ll TT[2500];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>S>>X>>Y>>Z;
	
	A[0]=S;
	FOR(i,N) A[i+1]=(X*A[i]+Y)%Z;
	FOR(i,N) C[i/50]|=(A[i]%2)<<(i%50);
	
	cin>>Q;
	while(Q--) {
		cin>>S>>T>>U>>V;
		ll sp=T-S+1;
		S--,U--;
		FOR(i,sp/50+2) TT[1+i]=C[S/50+i];
		FOR(i,sp/50+2) TT[1+i]=(TT[1+i]>>(S%50)) | ((TT[i+2]&((1LL<<(S%50))-1)))<<(50-S%50);
		FOR(i,sp/50+4) {
			if((i+1)*50<=sp) continue;
			else if((i+1)*50-sp<=50) TT[i+1]&=(1LL<<(sp%50))-1;
			else TT[i+i]=0;
		}
		for(i=sp/50+2;i>=0;i--) TT[i+1]=((TT[i+1]<<(U%50)) | (TT[i]>>(50-U%50))) & ((1LL<<50)-1);
		FOR(i,sp/50+2) C[i+U/50] ^= TT[i+1];
	}
	
	
	FOR(i,N) _P("%c","EO"[(C[i/50]>>(i%50))&1]);
	_P("\n");
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}
0