結果

問題 No.698 ペアでチームを作ろう
ユーザー Nikkuniku029
提出日時 2021-08-29 07:18:16
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 301 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-11-22 02:57:06
合計ジャッジ時間 8,838 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 3 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dp=[0]*(1<<n)
for s in range(1<<n):
    for a in range(n):
        for b in range(a+1,n):
            if not(s>>a)&1: 
                if not(s>>b)&1:
                    dp[s|(1<<a)|(1<<b)]=max(dp[s|(1<<a)|(1<<b)],dp[s]+A[a]^A[b])

print(dp[(1<<n)-1])
0