結果
| 問題 | 
                            No.142 単なる配列の操作に関する実装問題
                             | 
                    
| コンテスト | |
| ユーザー | 
                             maspy
                         | 
                    
| 提出日時 | 2020-05-01 01:27:08 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,122 bytes | 
| コンパイル時間 | 505 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 122,752 KB | 
| 最終ジャッジ日時 | 2024-12-21 09:16:26 | 
| 合計ジャッジ時間 | 22,605 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 4 TLE * 1 | 
ソースコード
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 str(x & 1)
        x = (X * x + Y) % Z
A_str = ''.join(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(L, R):
    i = L // B
    L -= B * i
    R -= B * i
    if B >= R:
        return nums[i] >> L & ((1 << R - L) - 1)
    else:
        mask = (1 << R - B) - 1
        return (nums[i] >> L) ^ (nums[i + 1] & mask) << B - L
def add(L, R, x):
    i = L // B
    L -= B * i
    R -= B * i
    if B >= R:
        nums[i] ^= x << L
        return
    nums[i] ^= (x & ((1 << B - L) - 1)) << L
    nums[i + 1] ^= x >> (B - L)
Q = int(readline())
m = map(int, read().split())
for s, t, u, v in zip(m, m, m, m):
    add(u - 1, v, get(s - 1, t))
for i in range(len(nums)):
    nums[i] = bin(nums[i])[2:][::-1]
    nums[i] += '0' * (B - len(nums[i]))
x = ''.join(nums)[:N]
print(x.replace('0', 'E').replace('1', 'O'))
            
            
            
        
            
maspy