結果

問題 No.130 XOR Minimax
ユーザー nebukuro09nebukuro09
提出日時 2016-09-27 17:24:33
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 428 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 76,964 KB
実行使用メモリ 197,248 KB
最終ジャッジ日時 2024-05-01 05:43:12
合計ジャッジ時間 3,790 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 72 ms
75,520 KB
testcase_02 AC 67 ms
75,392 KB
testcase_03 AC 68 ms
75,776 KB
testcase_04 AC 198 ms
197,248 KB
testcase_05 AC 183 ms
169,568 KB
testcase_06 WA -
testcase_07 AC 140 ms
137,384 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = input()
a = map(int, raw_input().split())

def rec(L, p):
    if p > 30 or len(L) == 0:
        return 0
    L0 = []
    L1 = []
    b = (1 << (30-p))
    for e in L:
        if e & b:
            L1.append(e)
        else:
            L0.append(e)
    if len(L0) == 0:
        return rec(L1, p+1)
    elif len(L1) == 0:
        return rec(L0, p+1)
    else:
        return b + min(rec(L0, p+1), (L1, p+1))

print rec(a, 0)
0