結果
問題 | No.698 ペアでチームを作ろう |
ユーザー | 👑 H20 |
提出日時 | 2021-05-27 10:26:22 |
言語 | PyPy3 (7.3.13) |
結果 |
WA
|
実行時間 | - |
コード長 | 497 bytes |
コンパイル時間 | 296 ms |
コンパイル使用メモリ | 87,188 KB |
実行使用メモリ | 77,204 KB |
最終ジャッジ日時 | 2023-08-06 03:16:01 |
合計ジャッジ時間 | 2,587 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 105 ms
76,736 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
ソースコード
def main(): N = int(input()) A = list(map(int,input().split())) dp = [0]*(1<<N) for s in range(1, 1<<N):#集合を添字の小さい順に試す for i in range(N):#全ての要素のペアを考える for j in range(i+1,N): if not ((s>>i)&1) and not ((s>>j)&1):#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())