結果
| 問題 | 
                            No.142 単なる配列の操作に関する実装問題
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2015-05-27 21:15:33 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1,343 ms / 5,000 ms | 
| コード長 | 1,046 bytes | 
| コンパイル時間 | 321 ms | 
| コンパイル使用メモリ | 37,632 KB | 
| 実行使用メモリ | 6,940 KB | 
| 最終ジャッジ日時 | 2024-07-06 11:06:33 | 
| 合計ジャッジ時間 | 5,600 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 5 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:16:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |         scanf("%d%d%d%d%d%d",&N,&S,&T,&U,&V,&Q);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:26:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   26 |                 scanf("%d%d%d%d",&S,&T,&U,&V);S--,U--;
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
//#include "inspect.hpp"
#include <vector>
#include <cstdio>
using namespace std;
typedef unsigned long long ull;
ull shr(ull n,int shift){
	if(shift>=64)return 0;
	return n>>shift;
}
ull shl(ull n,int shift){
	if(shift>=64)return 0;
	return n<<shift;
}
int main(){
	int N,S,T,U,V,Q;
	scanf("%d%d%d%d%d%d",&N,&S,&T,&U,&V,&Q);
	vector<ull>A((N+63)/64+1),B((N+63)/64+1);
	A[0]=S&1;
	for(int i=1;i<N;i++){
		S=((long long)T*S+U)%V;
		int y=i/64,x=i%64;
		A[y]|=(ull)(S&1)<<x;
	}
	//cout<<A<<endl;
	for(;Q--;){
		scanf("%d%d%d%d",&S,&T,&U,&V);S--,U--;
		int L=(T-S+63)/64;
		//printf("%d %d %d %lld\n",L,S/64,S%64,((ull)3)>>(64-0));
		{
			for(int i=0;i<L;i++){
				B[i]=shr(A[S/64+i],S%64);
				B[i]|=shl(A[S/64+i+1],64-S%64);
			}
			if((T-S)%64)B[L-1]=shr(shl(B[L-1],64-(T-S)%64),64-(T-S)%64);
			//printf("%x %d %lld\n",B[0],U,shr(B[0],64-U%64));
			for(int i=0;i<L;i++){
				A[U/64+i]^=shl(B[i],U%64);
				A[U/64+i+1]^=shr(B[i],64-U%64);
			}
		}
		//cout<<A<<endl;
	}
	for(int i=0;i<N;i++)putchar((A[i/64]>>(i%64)&1)?'O':'E');
	putchar('\n');
}