| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1300278 | javahirbek | Knapsack (NOI18_knapsack) | Pypy 3 | 1100 ms | 116440 KiB |
import sys
input = sys.stdin.readline
S, N = map(int, input().split())
Weights = [0]*N
Values = [0]*N
Cnt = [0]*N
for i in range(N):
Values[i], Weights[i], Cnt[i] = map(int, input().split())
items = []
for i in range(N):
w = Weights[i]
v = Values[i]
c = Cnt[i]
k = 1
while c > 0:
take = min(k, c)
items.append((w * take, v * take))
c -= take
k *= 2
dp = [0] * (S+1)
for w, v in items:
for j in range(S, w-1, -1):
dp[j] = max(dp[j], dp[j-w] + v)
print(dp[S])컴파일 시 표준 출력 (stdout) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
