結果

問題 No.698 ペアでチームを作ろう
ユーザー Poina15Poina15
提出日時 2018-09-01 15:54:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 402 bytes
コンパイル時間 133 ms
コンパイル使用メモリ 11,848 KB
実行使用メモリ 15,016 KB
最終ジャッジ日時 2023-10-19 02:42:38
合計ジャッジ時間 7,340 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,164 KB
testcase_01 AC 31 ms
10,052 KB
testcase_02 AC 69 ms
10,080 KB
testcase_03 AC 31 ms
10,052 KB
testcase_04 AC 232 ms
10,212 KB
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
dp = [0] * (1 << N)
for msk in range(1 << N):
    for i in range(N):
        if msk & 1 << i:
            continue
        for j in range(N):
            if msk & 1 << j:
                continue
            dp[msk | 1 << i | 1 << j] = max(dp[msk | 1 << i | 1 << j],
                                            dp[msk] + (A[i] ^ A[j]))
print(dp[-1])
0