結果

問題 No.130 XOR Minimax
ユーザー NoneNone
提出日時 2021-03-25 14:42:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 385 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 81,536 KB
実行使用メモリ 199,996 KB
最終ジャッジ日時 2024-05-05 07:44:15
合計ジャッジ時間 3,615 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 42 ms
51,584 KB
testcase_02 AC 41 ms
51,840 KB
testcase_03 AC 40 ms
51,968 KB
testcase_04 AC 62 ms
76,544 KB
testcase_05 AC 205 ms
199,996 KB
testcase_06 AC 77 ms
84,096 KB
testcase_07 WA -
testcase_08 AC 83 ms
90,880 KB
testcase_09 AC 56 ms
64,256 KB
testcase_10 AC 61 ms
66,048 KB
testcase_11 AC 87 ms
82,816 KB
testcase_12 WA -
testcase_13 AC 79 ms
78,080 KB
testcase_14 AC 91 ms
87,552 KB
testcase_15 AC 46 ms
57,984 KB
testcase_16 AC 80 ms
79,488 KB
testcase_17 AC 80 ms
79,744 KB
testcase_18 WA -
testcase_19 AC 88 ms
84,864 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 60 ms
66,432 KB
testcase_23 AC 55 ms
62,336 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