結果
| 問題 |
No.617 Nafmo、買い出しに行く
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-17 20:18:51 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 641 bytes |
| コンパイル時間 | 204 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 65,280 KB |
| 最終ジャッジ日時 | 2024-12-15 22:53:22 |
| 合計ジャッジ時間 | 2,664 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 2 |
| other | RE * 20 |
ソースコード
#!/usr/bin/env python
import pulp
def maximize(capacity, weight):
r = range(len(weight))
problem = pulp.LpProblem(sense=pulp.LpMaximize)
variable = [pulp.LpVariable('x%d'%i, cat=pulp.LpBinary) for i in r]
problem += pulp.lpDot(weight, variable)
problem += pulp.lpDot(weight, variable) <= capacity
problem.solve()
return pulp.value(problem.objective)
indat = [int(x) for x in input().split()]
weights = list()
for i in range(indat[0]):
x = int(input())
if x < indat[1]:
weights.append(x)
elif x == indat[1]:
print(x)
exit()
ans = int(maximize(indat[1], weights))
print(ans)