結果

問題 No.698 ペアでチームを作ろう
ユーザー ronin_2020ronin_2020
提出日時 2021-11-20 16:10:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 379 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 10,636 KB
実行使用メモリ 8,772 KB
最終ジャッジ日時 2023-09-02 10:56:03
合計ジャッジ時間 6,308 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,788 KB
testcase_01 AC 14 ms
7,820 KB
testcase_02 WA -
testcase_03 AC 15 ms
7,764 KB
testcase_04 WA -
testcase_05 AC 469 ms
8,116 KB
testcase_06 AC 484 ms
8,220 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):
    for u in range(N-1):
        if S & (1 << u):
            continue
        for v in range(u+1, N):
            if S & (1 << v):
                continue
            dp[S | (1 << u) | (1 << v)] = max(dp[S | (1 << u) | (1 << v)], dp[S] + A[u] ^ A[v])

# print(dp)
print(dp[-1])
0