結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 185 ms
14,568 KB
testcase_01 AC 16 ms
8,092 KB
testcase_02 AC 16 ms
8,092 KB
testcase_03 AC 16 ms
7,920 KB
testcase_04 AC 33 ms
9,192 KB
testcase_05 AC 49 ms
16,184 KB
testcase_06 AC 121 ms
24,704 KB
testcase_07 AC 125 ms
24,400 KB
testcase_08 AC 378 ms
24,720 KB
testcase_09 AC 39 ms
10,332 KB
testcase_10 AC 49 ms
12,976 KB
testcase_11 AC 104 ms
18,076 KB
testcase_12 AC 29 ms
9,496 KB
testcase_13 AC 89 ms
16,632 KB
testcase_14 AC 341 ms
23,408 KB
testcase_15 AC 21 ms
8,056 KB
testcase_16 AC 244 ms
16,888 KB
testcase_17 AC 253 ms
17,052 KB
testcase_18 AC 272 ms
17,668 KB
testcase_19 AC 320 ms
18,724 KB
testcase_20 AC 167 ms
14,324 KB
testcase_21 AC 338 ms
23,304 KB
testcase_22 AC 88 ms
10,576 KB
testcase_23 AC 38 ms
8,880 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)))
0