結果

問題 No.130 XOR Minimax
ユーザー rpy3cpp
提出日時 2015-07-10 11:57:02
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 438 ms / 5,000 ms
コード長 290 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 27,244 KB
最終ジャッジ日時 2024-09-12 22:35:50
合計ジャッジ時間 5,242 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
N=input()
A=list(set(map(int,input().split())))
A.sort()
def f(i,b,e):
 if i==1 or e<=b: return 0
 j=i>>1
 if not(A[e-1]&j) or A[b]&j: return f(j,b,e)
 m=bisect.bisect_left(A,-i&A[b]|j,b,e)
 return j+min(f(j,b,m),f(j,m,e))
print(f(1<<len(bin(A[-1])),0,len(A)) if A[-1] else 0)
0