結果

問題 No.814 ジジ抜き
ユーザー maspy
提出日時 2020-03-25 02:22:22
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 690 ms / 3,000 ms
コード長 575 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 12,288 KB
実行使用メモリ 10,368 KB
最終ジャッジ日時 2025-01-01 19:19:58
合計ジャッジ時間 13,662 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())


def xor_cumsum(N):
    r = N % 4
    if r == 0:
        return N
    elif r == 1:
        return 1
    elif r == 2:
        return N ^ 1
    return 0


def f(K, L, D):
    L1 = L >> D
    x = 0
    if K & 1:
        x = L & ((1 << D) - 1)
    y = xor_cumsum(L1 + K - 1) ^ xor_cumsum(L1 - 1)
    return (y << D) ^ x


x = 0
for _ in range(N):
    K, L, D = map(int, readline().split())
    x ^= f(K, L, D)
print(x)
0