結果

問題 No.698 ペアでチームを作ろう
ユーザー brthyyjpbrthyyjp
提出日時 2021-02-10 20:49:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 449 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 77,528 KB
最終ジャッジ日時 2023-09-22 16:43:29
合計ジャッジ時間 2,812 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,284 KB
testcase_01 AC 72 ms
71,444 KB
testcase_02 WA -
testcase_03 AC 71 ms
71,052 KB
testcase_04 WA -
testcase_05 AC 101 ms
76,572 KB
testcase_06 AC 115 ms
77,204 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(map(int, input().split()))

dp = [0]*(1<<n)
for s in range(1<<n):
    p = 0
    for i in range(n):
        if (s>>i)&1:
            p += 1
    if p%2 == 1:
        continue
    for i in range(n-1):
        if (s>>i)&1:
            continue
        for j in range(i+1, n):
            if (s>>j)&1:
                continue
            dp[s|(1<<i)|(1<<j)] = max(dp[s|(1<<i)|(1<<j)], dp[s]+A[i]^A[j])
#print(dp)
print(dp[-1])
0