# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1222339 | marcusufabc | Knapsack (NOI18_knapsack) | Pypy 3 | 1097 ms | 51872 KiB |
max_weight, num_items = map(int, input().split())
# d[i] is the maximum value we can achieve with a basket of weight i
dp = [0] * (max_weight + 1)
for _ in range(num_items):
value, weight, quantity = map(int, input().split())
# process each item for each available unit of it
for q in range(1, quantity + 1):
for w in range(max_weight, weight - 1, -1):
dp[w] = max(dp[w], dp[w - weight] + value)
print(dp[max_weight])
컴파일 시 표준 출력 (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... |