結果
問題 | No.142 単なる配列の操作に関する実装問題 |
ユーザー | maspy |
提出日時 | 2020-04-30 23:02:56 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,252 bytes |
コンパイル時間 | 601 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 271,820 KB |
最終ジャッジ日時 | 2024-05-10 01:43:40 |
合計ジャッジ時間 | 12,660 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | TLE | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
ソースコード
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines B = 10 ** 5 + 10 N, S, X, Y, Z = map(int, readline().split()) def gen_A(): x = S for i in range(N): yield x & 1 x = X * x + Y x %= Z A_str = ''.join(map(str, gen_A())) nums = [] for i in range((N + B - 1) // B): nums.append(int(A_str[B * i:B * i + B][::-1], 2)) def get_local(n, L, R): n >>= L return n & ((1 << R - L) - 1) def get(L, R): i = L // B L -= B * i R -= B * i if B >= R: return get_local(nums[i], L, R) left = get_local(nums[i], L, B) right = get_local(nums[i+1], 0, R-B) return left ^ (right << B - L) def add_local(i, L, R, x): nums[i] ^= x << L def add(L, R, x): i = L // B L -= B * i R -= B * i if B >= R: add_local(i, L, R, x) return left = x & ((1 << B - L) - 1) right = x >> (B - L) add_local(i, L, B, left) add_local(i+1, 0, R-B, right) Q = int(readline()) m = map(int, read().split()) for s,t,u,v in zip(m,m,m,m): x = get(s-1,t) add(u-1, v, x) x = ''.join(map(lambda x: bin(x)[2:][::-1], nums)) x += '0' * (N - len(x)) print(x.replace('0', 'E').replace('1','O'))