結果

問題 No.142 単なる配列の操作に関する実装問題
ユーザー Lepton_sLepton_s
提出日時 2015-02-02 00:22:11
言語 C++11
(gcc 11.4.0)
結果
OLE  
実行時間 -
コード長 1,452 bytes
コンパイル時間 811 ms
コンパイル使用メモリ 77,488 KB
実行使用メモリ 16,468 KB
最終ジャッジ日時 2023-09-05 10:10:02
合計ジャッジ時間 17,302 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<25;
typedef pair<int,int> P;
typedef long long ll;
typedef unsigned long long ull;
#define N 2000000
int a[N];
ull A[N/64+100], B[N/64+100];

void bxor(ull *A, int a, ull *B, int b, int n){
	int ma = a%64, mb = b%64;
	int aa = a/64, bb = b/64;
	for(int i = 0; i < (n+64); i++){
		ull e = (B[bb+i]>>mb) | (B[bb+i])<<(64-mb);
		int ct = i+64-n;
		if(ct>0) e = (e<<ct)>>ct;
		A[aa+i] ^= e<<ma; A[aa+i+1] ^= e>>(64-ma);
	}
}

int main(){
	ll n, x, y, z;
	cin>>n>>a[0]>>x>>y>>z;
	for(int i = 1; i < n; i++)
		a[i] = (a[i-1]*x+y)%z;
	for(int i = 0; i < n; i++)
		A[i/64] |= (a[i]&1)<<(i%64);
	int q;
	cin>>q;
	for(int i = 0; i < q; i++){
		for(int j = 0; j < n; j++)
			printf("%c",A[j/64]&(1<<j)?'O':'E');
		puts("");
		int s, t, u, v;
		scanf(" %d %d %d %d", &s, &t, &u, &v);
		s--; u--;
		int ss = s/64*64, uu = u/64*64;
		int m = t-s;
		memset(B, 0, sizeof(B)/8);
		bxor(B, 0, A, s, m);
		bxor(A, u, B, 0, m);
	}
	for(int i = 0; i < n; i++)
		printf("%c",A[i/64]&(1<<i)?'O':'E');
	puts("");
	return 0;
}
0