結果
問題 |
No.2061 XOR Sort
|
ユーザー |
![]() |
提出日時 | 2025-04-15 21:46:24 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 854 bytes |
コンパイル時間 | 519 ms |
コンパイル使用メモリ | 82,856 KB |
実行使用メモリ | 230,260 KB |
最終ジャッジ日時 | 2025-04-15 21:48:06 |
合計ジャッジ時間 | 10,382 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 2 WA * 39 |
ソースコード
MOD = 998244353 class Node: __slots__ = ['left', 'right'] def __init__(self): self.left = None self.right = None n = int(input()) A = list(map(int, input().split())) root = Node() m = 0 for num in A: node = root for bit in reversed(range(30)): # Process bits from 29 down to 0 current_bit = (num >> bit) & 1 if current_bit == 0: if not node.left: node.left = Node() # Check if the right child exists now if node.right: m += 1 child = node.left else: if not node.right: node.right = Node() # Check if the left child exists now if node.left: m += 1 child = node.right node = child print(pow(2, m, MOD))