結果

問題 No.699 ペアでチームを作ろう2
ユーザー convexineq
提出日時 2021-03-30 03:43:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 156 ms / 1,000 ms
コード長 288 bytes
コンパイル時間 927 ms
コンパイル使用メモリ 81,868 KB
実行使用メモリ 76,544 KB
最終ジャッジ日時 2024-11-29 23:50:09
合計ジャッジ時間 2,991 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
*a, = map(int,input().split())

def dfs(k,v):
    if k==0:
        return v
    c = 0
    idx = (k&-k).bit_length() - 1
    k ^= 1<<idx
    for i in range(idx+1,n):
        if k>>i&1:
            c = max(c,dfs(k^(1<<i),v^(a[idx]+a[i])))
    return c

print(dfs(2**n-1,0))
0