結果
問題 |
No.142 単なる配列の操作に関する実装問題
|
ユーザー |
![]() |
提出日時 | 2025-06-12 15:04:20 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,199 bytes |
コンパイル時間 | 288 ms |
コンパイル使用メモリ | 82,712 KB |
実行使用メモリ | 200,892 KB |
最終ジャッジ日時 | 2025-06-12 15:05:34 |
合計ジャッジ時間 | 13,246 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 4 |
ソースコード
def main(): import sys input = sys.stdin.read data = input().split() idx = 0 N = int(data[idx]) idx += 1 S = int(data[idx]) idx += 1 X = int(data[idx]) idx += 1 Y = int(data[idx]) idx += 1 Z = int(data[idx]) idx += 1 # Compute initial A mod Z a = [0] * N a[0] = S % Z for i in range(1, N): a[i] = (X * a[i-1] + Y) % Z # Compute parities par = [x % 2 for x in a] Q = int(data[idx]) idx += 1 for _ in range(Q): S_op = int(data[idx]) idx += 1 T_op = int(data[idx]) idx += 1 U_op = int(data[idx]) idx += 1 V_op = int(data[idx]) idx += 1 s = S_op - 1 t = T_op - 1 u = U_op - 1 v = V_op - 1 len_b = t - s + 1 b = par[s:s + len_b] for i in range(len_b): pos = u + i if pos >= N: break par[pos] ^= b[i] # Prepare the output output = [] for p in par: if p == 0: output.append('E') else: output.append('O') print(''.join(output)) if __name__ == "__main__": main()