Submission #4074876
Source Code Expand
N, W = map(int, input().split()) wv = [list(map(int, input().split())) for i in range(N)] dp = [[0] * (W+1) for i in range(N+1)] for i in range(N): for j in range(1, W + 1): dp[i+1][j] = dp[i][j] if 0 <= j - wv[i][0] <= W: dp[i+1][j] = max(dp[i][j], dp[i][j - wv[i][0]] + wv[i][1]) print(dp[-1][-1])
Submission Info
Submission Time | |
---|---|
Task | D - Simple Knapsack |
User | yutala |
Language | Python (3.4.3) |
Score | 0 |
Code Size | 345 Byte |
Status | RE |
Exec Time | 2060 ms |
Memory | 1974388 KB |
Judge Result
Set Name | Sample | All | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | example0, example1, example2, example3 |
All | antigreedy0, antigreedy1, antigreedy2, example0, example1, example2, example3, quarter0, quarter1, quarter2, rand0, rand1, rand2, smallw0, smallw1, smallw2 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
antigreedy0 | RE | 18 ms | 3064 KB |
antigreedy1 | RE | 18 ms | 3064 KB |
antigreedy2 | RE | 18 ms | 3064 KB |
example0 | AC | 18 ms | 3064 KB |
example1 | AC | 18 ms | 3064 KB |
example2 | AC | 18 ms | 3064 KB |
example3 | AC | 18 ms | 3064 KB |
quarter0 | AC | 443 ms | 13172 KB |
quarter1 | AC | 410 ms | 11764 KB |
quarter2 | AC | 132 ms | 4968 KB |
rand0 | TLE | 2060 ms | -1460620 KB |
rand1 | RE | 1746 ms | -1709836 KB |
rand2 | MLE | 1401 ms | 1974388 KB |
smallw0 | AC | 55 ms | 3700 KB |
smallw1 | AC | 81 ms | 3828 KB |
smallw2 | AC | 39 ms | 3316 KB |