結果

問題 No.130 XOR Minimax
ユーザー kohei2019kohei2019
提出日時 2021-08-02 22:08:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 333 bytes
コンパイル時間 1,674 ms
コンパイル使用メモリ 86,252 KB
実行使用メモリ 115,616 KB
最終ジャッジ日時 2023-10-14 20:54:59
合計ジャッジ時間 5,461 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 72 ms
70,896 KB
testcase_02 AC 70 ms
70,812 KB
testcase_03 AC 72 ms
70,896 KB
testcase_04 AC 126 ms
113,216 KB
testcase_05 AC 131 ms
115,616 KB
testcase_06 AC 133 ms
114,172 KB
testcase_07 WA -
testcase_08 AC 142 ms
115,412 KB
testcase_09 AC 86 ms
76,324 KB
testcase_10 AC 90 ms
83,056 KB
testcase_11 WA -
testcase_12 AC 82 ms
76,188 KB
testcase_13 AC 112 ms
101,200 KB
testcase_14 AC 126 ms
109,380 KB
testcase_15 AC 78 ms
75,784 KB
testcase_16 AC 112 ms
98,736 KB
testcase_17 AC 112 ms
99,220 KB
testcase_18 AC 115 ms
101,444 KB
testcase_19 AC 122 ms
106,400 KB
testcase_20 AC 100 ms
89,392 KB
testcase_21 AC 125 ms
109,128 KB
testcase_22 WA -
testcase_23 AC 83 ms
76,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
lsa = list(map(int,input().split()))
# 上からビットを立てるか否かを決めていく貪欲法。

v = 0
for i in range(30,-1,-1):
    c = 1<<i
    m1 = max(lsa)
    lsb = lsa[:]
    for j in range(N):
        lsb[j] ^= c
    m2 = max(lsb)
    if m1 > m2:
        v += c
        lsa = lsb

print(max(lsa))
0