結果

問題 No.130 XOR Minimax
ユーザー NoneNone
提出日時 2021-03-25 14:42:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 385 bytes
コンパイル時間 1,163 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 201,168 KB
最終ジャッジ日時 2023-08-18 00:54:04
合計ジャッジ時間 5,481 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 73 ms
71,228 KB
testcase_02 AC 72 ms
71,404 KB
testcase_03 AC 72 ms
71,404 KB
testcase_04 AC 90 ms
88,084 KB
testcase_05 AC 221 ms
201,168 KB
testcase_06 AC 160 ms
91,540 KB
testcase_07 WA -
testcase_08 AC 108 ms
93,852 KB
testcase_09 AC 83 ms
76,372 KB
testcase_10 AC 87 ms
77,752 KB
testcase_11 AC 111 ms
89,920 KB
testcase_12 WA -
testcase_13 AC 166 ms
86,352 KB
testcase_14 AC 116 ms
91,620 KB
testcase_15 AC 78 ms
75,812 KB
testcase_16 AC 102 ms
85,808 KB
testcase_17 AC 103 ms
86,068 KB
testcase_18 WA -
testcase_19 AC 109 ms
89,664 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 85 ms
77,016 KB
testcase_23 AC 82 ms
76,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int, input().split()))
A.sort()
M=A[-1]
L=M.bit_length()
for i in range(L)[::-1]:
    if (M>>i)&1==0:
        continue
    B=[]
    cnt=0
    for a in A:
        if (a>>i)&1:
            B.append(a)
        else:
            cnt+=1
    if cnt==0:
        A=[]
        M^=(1<<i)
        for b in B:
            A.append(b^(1<<i))
    else:
        A=B
print(M)
0