結果
問題 |
No.2061 XOR Sort
|
ユーザー |
|
提出日時 | 2022-08-28 15:32:59 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 742 ms / 2,000 ms |
コード長 | 613 bytes |
コンパイル時間 | 508 ms |
コンパイル使用メモリ | 82,688 KB |
実行使用メモリ | 295,760 KB |
最終ジャッジ日時 | 2024-10-15 14:00:09 |
合計ジャッジ時間 | 10,864 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
N = int(input()) A = list(map(int,input().split())) P = 998244353 count = 0 l = [A] for i in range(29,-1,-1): mask = 1 << i nx = [] flag = False for ll in l: left = [] right = [] for u in ll: if u & mask == 0: left.append(u) else: right.append(u) if len(left) == 0 or len(right) == 0: pass else: flag = True if len(left): nx.append(left) if len(right): nx.append(right) if flag: count += 1 l = nx print(pow(2,count,P))