結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー first_vil
提出日時 2020-06-26 13:56:33
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 2,246 ms / 5,000 ms
コード長 387 bytes
コンパイル時間 115 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 21,916 KB
最終ジャッジ日時 2024-07-04 12:55:22
合計ジャッジ時間 38,817 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=sorted(list(map(int,input().split())),reverse=True)
rank=0
for j in range(60,-1,-1):
    idx=-1
    for i in range(rank,n):
        if a[i]&(1<<j):
            idx=i
            break
    if idx==-1:
        continue
    (a[rank],a[idx])=(a[idx],a[rank])
    for i in range(n):
        if a[i]&(1<<j) and not i==rank:
            a[i]^=a[rank]
    rank+=1
print(1<<rank)
0