結果
| 問題 |
No.2061 XOR Sort
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-15 21:50:05 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 854 bytes |
| コンパイル時間 | 344 ms |
| コンパイル使用メモリ | 82,440 KB |
| 実行使用メモリ | 230,280 KB |
| 最終ジャッジ日時 | 2025-04-15 21:51:49 |
| 合計ジャッジ時間 | 9,235 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))
lam6er