結果
問題 |
No.814 ジジ抜き
|
ユーザー |
![]() |
提出日時 | 2025-04-16 00:17:47 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,314 bytes |
コンパイル時間 | 180 ms |
コンパイル使用メモリ | 82,180 KB |
実行使用メモリ | 173,776 KB |
最終ジャッジ日時 | 2025-04-16 00:19:26 |
合計ジャッジ時間 | 16,603 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | MLE * 23 |
ソースコード
import sys def main(): input = sys.stdin.read().split() ptr = 0 N = int(input[ptr]) ptr += 1 players = [] for _ in range(N): K = int(input[ptr]) L = int(input[ptr+1]) D = int(input[ptr+2]) ptr += 3 players.append((K, L, D)) x = 0 for b in range(60): total = 0 for (K, L, D) in players: if b < D: # Case 1: b < D bit = (L >> b) & 1 res = (K % 2) * bit elif b == D: # Case 2: b == D bit = (L >> b) & 1 if bit: cnt = (K + 1) // 2 else: cnt = K // 2 res = cnt % 2 else: # Case 3: b > D s = 1 << D mask = (1 << (D + 1)) - 1 base = L & mask required = 1 << b numerator = required - base if numerator <= 0: m_min = 0 else: m_min = (numerator + s - 1) // s cnt = max(0, K - m_min) res = cnt % 2 total ^= res if total % 2 == 1: x |= (1 << b) print(x) if __name__ == "__main__": main()