結果
問題 |
No.698 ペアでチームを作ろう
|
ユーザー |
![]() |
提出日時 | 2021-05-27 10:29:19 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 491 bytes |
コンパイル時間 | 440 ms |
コンパイル使用メモリ | 82,420 KB |
実行使用メモリ | 76,136 KB |
最終ジャッジ日時 | 2024-11-06 06:12:29 |
合計ジャッジ時間 | 1,909 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 3 WA * 9 |
ソースコード
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())