S, N = map(int, raw_input().split())
dp = [0]*(S+1)
for _ in range(N):
V, W, K = map(int, raw_input().split())
for k in range(K):
for s in range(S, W-1, -1):
dp[s] = max(dp[s], dp[s-W] + V)
print (max(dp))
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1103 ms |
81272 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
2936 KB |
Output is correct |
2 |
Correct |
95 ms |
3064 KB |
Output is correct |
3 |
Correct |
95 ms |
3064 KB |
Output is correct |
4 |
Correct |
16 ms |
2856 KB |
Output is correct |
5 |
Correct |
15 ms |
2936 KB |
Output is correct |
6 |
Correct |
57 ms |
3064 KB |
Output is correct |
7 |
Correct |
57 ms |
3064 KB |
Output is correct |
8 |
Correct |
53 ms |
3064 KB |
Output is correct |
9 |
Correct |
53 ms |
3064 KB |
Output is correct |
10 |
Correct |
58 ms |
3064 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
2936 KB |
Output is correct |
2 |
Correct |
95 ms |
3064 KB |
Output is correct |
3 |
Correct |
95 ms |
3064 KB |
Output is correct |
4 |
Correct |
16 ms |
2856 KB |
Output is correct |
5 |
Correct |
15 ms |
2936 KB |
Output is correct |
6 |
Correct |
57 ms |
3064 KB |
Output is correct |
7 |
Correct |
57 ms |
3064 KB |
Output is correct |
8 |
Correct |
53 ms |
3064 KB |
Output is correct |
9 |
Correct |
53 ms |
3064 KB |
Output is correct |
10 |
Correct |
58 ms |
3064 KB |
Output is correct |
11 |
Correct |
14 ms |
2936 KB |
Output is correct |
12 |
Correct |
836 ms |
2936 KB |
Output is correct |
13 |
Correct |
97 ms |
3064 KB |
Output is correct |
14 |
Correct |
15 ms |
2936 KB |
Output is correct |
15 |
Correct |
16 ms |
2936 KB |
Output is correct |
16 |
Correct |
228 ms |
3064 KB |
Output is correct |
17 |
Correct |
54 ms |
3064 KB |
Output is correct |
18 |
Correct |
77 ms |
3064 KB |
Output is correct |
19 |
Correct |
133 ms |
3064 KB |
Output is correct |
20 |
Correct |
118 ms |
2936 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1103 ms |
81272 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1103 ms |
81272 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |