結果
問題 |
No.142 単なる配列の操作に関する実装問題
|
ユーザー |
![]() |
提出日時 | 2025-06-12 15:02:51 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,228 bytes |
コンパイル時間 | 437 ms |
コンパイル使用メモリ | 82,656 KB |
実行使用メモリ | 176,328 KB |
最終ジャッジ日時 | 2025-06-12 15:03:36 |
合計ジャッジ時間 | 13,930 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 4 |
ソースコード
def main(): import sys input = sys.stdin.read().split() ptr = 0 N = int(input[ptr]); ptr += 1 S = int(input[ptr]); ptr += 1 X = int(input[ptr]); ptr += 1 Y = int(input[ptr]); ptr += 1 Z = int(input[ptr]); ptr += 1 # Generate initial array A with parity (0 for even, 1 for odd) A = [0] * N current = S A[0] = current % 2 for i in range(1, N): current = (X * current + Y) % Z A[i] = current % 2 Q = int(input[ptr]); ptr += 1 for _ in range(Q): S_op = int(input[ptr]); ptr += 1 T_op = int(input[ptr]); ptr += 1 U_op = int(input[ptr]); ptr += 1 V_op = int(input[ptr]); ptr += 1 # Adjust for 0-based indices S_0 = S_op - 1 T_0 = T_op - 1 U_0 = U_op - 1 V_0 = V_op - 1 # Extract B as a list of parities B = A[S_0 : T_0 + 1] # Apply XOR to A[U..V] for i in range(U_0, V_0 + 1): A[i] ^= B[i - U_0] # Convert to the required output string output = [] for num in A: if num == 0: output.append('E') else: output.append('O') print(''.join(output)) if __name__ == "__main__": main()