結果
| 問題 |
No.698 ペアでチームを作ろう
|
| ユーザー |
H20
|
| 提出日時 | 2021-05-27 10:26:22 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 497 bytes |
| コンパイル時間 | 169 ms |
| コンパイル使用メモリ | 81,972 KB |
| 実行使用メモリ | 76,140 KB |
| 最終ジャッジ日時 | 2024-11-06 06:10:21 |
| 合計ジャッジ時間 | 2,075 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | AC * 1 WA * 11 |
ソースコード
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())
H20