結果

問題 No.698 ペアでチームを作ろう
ユーザー sjikisjiki
提出日時 2021-09-27 00:55:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 391 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 10,732 KB
実行使用メモリ 9,288 KB
最終ジャッジ日時 2023-09-19 04:26:59
合計ジャッジ時間 8,064 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,436 KB
testcase_01 AC 19 ms
8,444 KB
testcase_02 WA -
testcase_03 AC 19 ms
8,576 KB
testcase_04 WA -
testcase_05 AC 630 ms
8,692 KB
testcase_06 AC 624 ms
8,828 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
inf=10**16
n = int(input())
A = list(map(int,input().split()))
dp=[-inf]*(1<<n)
dp[0] = 0
for bit in range(1<<n):
    pre=dp[bit]
    for a in range(n):
        for b in range(a+1,n):
            if not (bit& (1<< a)) and  not (bit& (1<< b)):
                nbit = bit + (1 << a) + (1 << b)
                dp[nbit]=max(dp[nbit],dp[bit]+A[a] ^ A[b])

print(dp[-1])
0