結果

問題 No.698 ペアでチームを作ろう
ユーザー 👑 H20H20
提出日時 2021-05-27 10:29:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 491 bytes
コンパイル時間 334 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 76,288 KB
最終ジャッジ日時 2024-04-23 23:47:35
合計ジャッジ時間 2,199 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,096 KB
testcase_01 AC 45 ms
52,096 KB
testcase_02 WA -
testcase_03 AC 42 ms
52,096 KB
testcase_04 WA -
testcase_05 AC 92 ms
75,776 KB
testcase_06 AC 97 ms
75,648 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 #

def main():
    N = int(input())
    A = list(map(int,input().split()))
    dp = [0]*(1<<N)
    for s in range(0, 1<<N):#集合を添字の小さい順に試す
        for i in range(N):#全ての要素のペアを考える
            for j in range(i+1,N):
                if (s>>i)&1==0 and  (s>>j)&1==0:#i in not s and j in not s
                    if dp[s+(1<<i)+(1<<j)]<dp[s]+A[i]^A[j]:
                        dp[s+(1<<i)+(1<<j)]=dp[s]+A[i]^A[j]
    return dp[-1]
print(main())    
0