結果

問題 No.130 XOR Minimax
ユーザー rpy3cpprpy3cpp
提出日時 2015-07-10 11:57:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 376 ms / 5,000 ms
コード長 290 bytes
コンパイル時間 403 ms
コンパイル使用メモリ 10,816 KB
実行使用メモリ 24,772 KB
最終ジャッジ日時 2023-10-10 00:09:25
合計ジャッジ時間 5,237 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 184 ms
14,488 KB
testcase_01 AC 17 ms
7,984 KB
testcase_02 AC 17 ms
7,972 KB
testcase_03 AC 17 ms
8,060 KB
testcase_04 AC 34 ms
9,128 KB
testcase_05 AC 49 ms
15,980 KB
testcase_06 AC 122 ms
24,772 KB
testcase_07 AC 124 ms
24,336 KB
testcase_08 AC 376 ms
24,664 KB
testcase_09 AC 39 ms
10,180 KB
testcase_10 AC 51 ms
12,932 KB
testcase_11 AC 102 ms
17,892 KB
testcase_12 AC 28 ms
9,476 KB
testcase_13 AC 88 ms
16,712 KB
testcase_14 AC 334 ms
23,388 KB
testcase_15 AC 20 ms
8,048 KB
testcase_16 AC 239 ms
16,816 KB
testcase_17 AC 249 ms
17,040 KB
testcase_18 AC 266 ms
17,896 KB
testcase_19 AC 315 ms
18,580 KB
testcase_20 AC 165 ms
14,440 KB
testcase_21 AC 331 ms
23,408 KB
testcase_22 AC 87 ms
10,340 KB
testcase_23 AC 38 ms
8,884 KB
権限があれば一括ダウンロードができます

ソースコード

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