結果
問題 |
No.2061 XOR Sort
|
ユーザー |
![]() |
提出日時 | 2025-04-16 15:43:31 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 846 bytes |
コンパイル時間 | 169 ms |
コンパイル使用メモリ | 82,216 KB |
実行使用メモリ | 289,908 KB |
最終ジャッジ日時 | 2025-04-16 15:46:35 |
合計ジャッジ時間 | 10,136 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 2 WA * 39 |
ソースコード
MOD = 998244353 def main(): import sys input = sys.stdin.read().split() N = int(input[0]) A = list(map(int, input[1:N+1])) current_groups = [A] ans = 1 for bit in reversed(range(30)): # from 29 down to 0 new_groups = [] for group in current_groups: mask = 1 << bit left = [] right = [] for x in group: if (x & mask) == 0: left.append(x) else: right.append(x) if len(left) > 0 and len(right) > 0: ans = (ans * 2) % MOD if left: new_groups.append(left) if right: new_groups.append(right) current_groups = new_groups print(ans % MOD) if __name__ == "__main__": main()