結果
問題 |
No.814 ジジ抜き
|
ユーザー |
![]() |
提出日時 | 2025-06-12 18:46:18 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 841 bytes |
コンパイル時間 | 281 ms |
コンパイル使用メモリ | 82,544 KB |
実行使用メモリ | 154,488 KB |
最終ジャッジ日時 | 2025-06-12 18:46:31 |
合計ジャッジ時間 | 8,081 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | MLE * 23 |
ソースコード
def xor(n): mod = n % 4 if mod == 0: return n elif mod == 1: return 1 elif mod == 2: return n + 1 else: return 0 def main(): import sys input = sys.stdin.read().split() ptr = 0 N = int(input[ptr]) ptr += 1 x = 0 for _ in range(N): K = int(input[ptr]) L = int(input[ptr+1]) D = int(input[ptr+2]) ptr += 3 s = 1 << D H = L // s a = H b = H + K - 1 if a == 0: higher = xor(b) else: higher = xor(b) ^ xor(a - 1) if K % 2 == 1: lower = L % s else: lower = 0 contribution = lower | (higher << D) x ^= contribution print(x) if __name__ == "__main__": main()