This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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);
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |