# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
972193 | Aika | Bank (IZhO14_bank) | C++14 | 1 ms | 448 KiB |
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>
#define int long long
#define aiiiii ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
signed main(){
aiiiii
int n, k, m, i, j;
cin>>n>>m;
int a[n], b[m];
for(i=0;i<n;i++){
cin>>a[i];
}
for(i=0;i<m;i++){
cin>>b[i];
}
bool a1=0;
int ans[a[0]+1];
for(i=1;i<=a[0];i++){
ans[i]=10001;
}
ans[0]=0;
for(j=0;j<m;j++){
for(int r=a[0];r>=0;r--){
if(ans[r]!=10001&&r+b[j]<=a[0])ans[r+b[j]]=min(ans[r+1],ans[r]+1);
}
}
if(ans[a[0]]!=10001)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
Compilation message (stderr)
# | 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... |