# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
972184 | Aika | Bank (IZhO14_bank) | C++14 | 1 ms | 456 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;
for(i=0;i<n;i++){
int ans[a[i]+1];
for(i=0;i<a[i];i++){
ans[i]=10001;
}
for(j=0;j<m;j++){
for(int r=a[i];r>=0;r--){
if(ans[r]!=10001&&r+b[j]<=a[i])ans[r+b[j]]=min(ans[r+1],ans[r]+1);
}
}
if(ans[a[i]]==10001)a1=1;
}
if(a1!=1)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... |