結果

問題 No.130 XOR Minimax
ユーザー rpy3cpp
提出日時 2015-07-10 11:59:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 443 ms / 5,000 ms
コード長 274 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 27,080 KB
最終ジャッジ日時 2024-09-12 22:35:40
合計ジャッジ時間 5,451 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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)))
0