結果

問題 No.698 ペアでチームを作ろう
ユーザー qywangohqywangoh
提出日時 2023-01-09 16:13:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 344 bytes
コンパイル時間 1,108 ms
コンパイル使用メモリ 10,656 KB
実行使用メモリ 8,736 KB
最終ジャッジ日時 2023-08-22 18:46:45
合計ジャッジ時間 7,942 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,732 KB
testcase_01 AC 15 ms
7,792 KB
testcase_02 WA -
testcase_03 AC 16 ms
7,800 KB
testcase_04 WA -
testcase_05 AC 652 ms
8,088 KB
testcase_06 AC 658 ms
8,064 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 #

n = int(input())
a_list = list(map(int, input().split()))

dp = [0] * (1<<n)

for mask in range(1<<n):
    for a in range(n):
        for b in range(a+1,n):
            if (1<<a)&mask == 0 and (1<<b)&mask == 0:
                dp[mask + ( 1<<a ) + (1<<b)] = max(dp[mask + (1<<a) + (1<< b)], dp[mask] + a_list[a]^a_list[b])
print(dp[(1<<n) -1])
0