結果

問題 No.698 ペアでチームを作ろう
ユーザー titiatitia
提出日時 2023-10-16 02:34:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 1,000 ms
コード長 367 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 86,876 KB
実行使用メモリ 77,488 KB
最終ジャッジ日時 2023-10-16 02:34:31
合計ジャッジ時間 2,898 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,340 KB
testcase_01 AC 72 ms
71,236 KB
testcase_02 AC 95 ms
76,696 KB
testcase_03 AC 72 ms
71,348 KB
testcase_04 AC 103 ms
76,664 KB
testcase_05 AC 107 ms
76,644 KB
testcase_06 AC 124 ms
77,176 KB
testcase_07 AC 122 ms
77,112 KB
testcase_08 AC 120 ms
76,916 KB
testcase_09 AC 119 ms
77,348 KB
testcase_10 AC 118 ms
77,256 KB
testcase_11 AC 123 ms
77,240 KB
testcase_12 AC 122 ms
77,488 KB
testcase_13 AC 116 ms
77,336 KB
testcase_14 AC 116 ms
77,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))

DP=[0]*(1<<N)

for i in range(1<<N):
    for j in range(N):
        if i & (1<<j) != 0:
            continue
        for k in range(N):
            if i & (1<<k) != 0:
                continue

            plus=A[j]^A[k]

            DP[i|(1<<j)|(1<<k)]=max(DP[i|(1<<j)|(1<<k)],DP[i]+plus)

print(DP[-1])
            
0