n,m=map(int,input().split())
a=list(map(int,input().split())) #메모리
c=list(map(int,input().split())) #가격
dp=[-999]*10001
dp[0]=0
for i in range(n):
for j in range(10000,-1,-1):
if(c[i]+j>10000 or dp[j]<0):continue
dp[c[i]+j]=max(dp[c[i]+j],dp[j]+a[i])
for i in range(10001):
if(dp[i]>=m):print(i);break
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
2900 KB |
Output is correct |
2 |
Correct |
59 ms |
2940 KB |
Output is correct |
3 |
Correct |
60 ms |
2940 KB |
Output is correct |
4 |
Correct |
63 ms |
2932 KB |
Output is correct |
5 |
Correct |
17 ms |
2900 KB |
Output is correct |
6 |
Correct |
66 ms |
2908 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
18 ms |
2900 KB |
Output is correct |
2 |
Correct |
52 ms |
2932 KB |
Output is correct |
3 |
Correct |
28 ms |
2856 KB |
Output is correct |
4 |
Correct |
50 ms |
2900 KB |
Output is correct |
5 |
Correct |
21 ms |
2848 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
128 ms |
2960 KB |
Output is correct |
2 |
Correct |
75 ms |
2912 KB |
Output is correct |
3 |
Correct |
155 ms |
2976 KB |
Output is correct |
4 |
Correct |
139 ms |
3000 KB |
Output is correct |
5 |
Correct |
151 ms |
3080 KB |
Output is correct |
6 |
Correct |
132 ms |
2956 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
77 ms |
2940 KB |
Output is correct |
2 |
Correct |
168 ms |
2920 KB |
Output is correct |
3 |
Correct |
126 ms |
2964 KB |
Output is correct |
4 |
Correct |
148 ms |
2932 KB |
Output is correct |
5 |
Correct |
131 ms |
2916 KB |
Output is correct |
6 |
Correct |
125 ms |
2900 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
359 ms |
3084 KB |
Output is correct |
2 |
Correct |
362 ms |
3004 KB |
Output is correct |
3 |
Correct |
390 ms |
3196 KB |
Output is correct |
4 |
Correct |
352 ms |
3060 KB |
Output is correct |
5 |
Correct |
268 ms |
3080 KB |
Output is correct |
6 |
Correct |
177 ms |
2980 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
350 ms |
2928 KB |
Output is correct |
2 |
Correct |
243 ms |
2996 KB |
Output is correct |
3 |
Correct |
238 ms |
3108 KB |
Output is correct |
4 |
Correct |
385 ms |
3152 KB |
Output is correct |
5 |
Correct |
233 ms |
2916 KB |
Output is correct |
6 |
Correct |
408 ms |
2972 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
423 ms |
3072 KB |
Output is correct |
2 |
Correct |
419 ms |
3236 KB |
Output is correct |
3 |
Correct |
483 ms |
3052 KB |
Output is correct |
4 |
Correct |
404 ms |
3044 KB |
Output is correct |