#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll C[10001],M,N;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cin>>N>>M;
vector<ll>m(N);
for(auto&I:m)cin>>I;
ll a;
int mi=10001;
for(auto&I:m)
{
cin>>a;
for(int i=mi-1;i>=a;--i)
{
if((C[i]=max(C[i],C[i-a]+I))>=M)
mi=i;
}
}
printf("%d",mi);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
3 ms |
624 KB |
Output is correct |
3 |
Correct |
3 ms |
624 KB |
Output is correct |
4 |
Correct |
2 ms |
756 KB |
Output is correct |
5 |
Correct |
2 ms |
852 KB |
Output is correct |
6 |
Correct |
2 ms |
852 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
940 KB |
Output is correct |
2 |
Correct |
2 ms |
940 KB |
Output is correct |
3 |
Correct |
2 ms |
940 KB |
Output is correct |
4 |
Correct |
3 ms |
940 KB |
Output is correct |
5 |
Correct |
2 ms |
940 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
940 KB |
Output is correct |
2 |
Correct |
2 ms |
940 KB |
Output is correct |
3 |
Correct |
2 ms |
940 KB |
Output is correct |
4 |
Correct |
3 ms |
940 KB |
Output is correct |
5 |
Correct |
2 ms |
940 KB |
Output is correct |
6 |
Correct |
3 ms |
940 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
940 KB |
Output is correct |
2 |
Correct |
3 ms |
940 KB |
Output is correct |
3 |
Correct |
3 ms |
940 KB |
Output is correct |
4 |
Correct |
4 ms |
940 KB |
Output is correct |
5 |
Correct |
3 ms |
988 KB |
Output is correct |
6 |
Correct |
3 ms |
988 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
988 KB |
Output is correct |
2 |
Correct |
3 ms |
996 KB |
Output is correct |
3 |
Correct |
18 ms |
996 KB |
Output is correct |
4 |
Correct |
4 ms |
1004 KB |
Output is correct |
5 |
Correct |
3 ms |
1004 KB |
Output is correct |
6 |
Correct |
3 ms |
1004 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
1108 KB |
Output is correct |
2 |
Correct |
3 ms |
1108 KB |
Output is correct |
3 |
Correct |
2 ms |
1108 KB |
Output is correct |
4 |
Correct |
4 ms |
1116 KB |
Output is correct |
5 |
Correct |
3 ms |
1116 KB |
Output is correct |
6 |
Correct |
3 ms |
1116 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
1116 KB |
Output is correct |
2 |
Correct |
3 ms |
1116 KB |
Output is correct |
3 |
Correct |
4 ms |
1116 KB |
Output is correct |
4 |
Correct |
4 ms |
1116 KB |
Output is correct |