結果
問題 |
No.814 ジジ抜き
|
ユーザー |
![]() |
提出日時 | 2025-06-12 13:47:09 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 998 bytes |
コンパイル時間 | 296 ms |
コンパイル使用メモリ | 82,252 KB |
実行使用メモリ | 154,396 KB |
最終ジャッジ日時 | 2025-06-12 13:47:25 |
合計ジャッジ時間 | 7,308 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | MLE * 23 |
ソースコード
def xor(n): if n < 0: return 0 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 res = 0 for _ in range(N): K = int(input[ptr]) L = int(input[ptr+1]) D = int(input[ptr+2]) ptr += 3 s = 1 << D lower = L % s a = (L - lower) // s count = K m = a + count - 1 if a > 0: xor_a_minus_1 = xor(a - 1) else: xor_a_minus_1 = 0 xor_m_val = xor(m) xor_high = xor_a_minus_1 ^ xor_m_val higher_part = s * xor_high if count % 2 == 1: lower_part = lower else: lower_part = 0 current_xor = lower_part ^ higher_part res ^= current_xor print(res) if __name__ == "__main__": main()