結果

問題 No.130 XOR Minimax
ユーザー None
提出日時 2021-03-25 14:42:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 385 bytes
コンパイル時間 440 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 200,128 KB
最終ジャッジ日時 2024-11-27 02:31:44
合計ジャッジ時間 3,452 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int, input().split()))
A.sort()
M=A[-1]
L=M.bit_length()
for i in range(L)[::-1]:
    if (M>>i)&1==0:
        continue
    B=[]
    cnt=0
    for a in A:
        if (a>>i)&1:
            B.append(a)
        else:
            cnt+=1
    if cnt==0:
        A=[]
        M^=(1<<i)
        for b in B:
            A.append(b^(1<<i))
    else:
        A=B
print(M)
0