結果
| 問題 | No.617 Nafmo、買い出しに行く |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-17 20:18:51 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
RE
不安定
|
| 実行時間 | - |
| コード長 | 641 bytes |
| 記録 | |
| コンパイル時間 | 64 ms |
| コンパイル使用メモリ | 83,064 KB |
| 実行使用メモリ | 74,664 KB |
| 最終ジャッジ日時 | 2026-10-04 05:55:49 |
| 合計ジャッジ時間 | 2,457 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)