結果
問題 |
No.698 ペアでチームを作ろう
|
ユーザー |
![]() |
提出日時 | 2021-02-10 20:56:01 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 97 ms / 1,000 ms |
コード長 | 443 bytes |
コンパイル時間 | 163 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 76,160 KB |
最終ジャッジ日時 | 2024-07-08 08:16:42 |
合計ジャッジ時間 | 1,907 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
n = int(input()) A = list(map(int, input().split())) dp = [0]*(1<<n) for s in range(1<<n): p = 0 for i in range(n): if (s>>i)&1: p += 1 if p%2 != 0: continue for i in range(n-1): if (s>>i)&1: continue for j in range(i+1, n): if (s>>j)&1: continue dp[s|1<<i|1<<j] = max(dp[s|1<<i|1<<j], dp[s]+(A[i]^A[j])) #print(dp) print(dp[-1])