Submission #880118

#TimeUsernameProblemLanguageResultExecution timeMemory
880118boris_7Bank (IZhO14_bank)C++17
0 / 100
1 ms600 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; void solve(){ int n,m; cin>>n>>m; vector<int>a(n); vector<int>b(m); for(int &i:a){ cin>>i; } for(int &i:b){ cin>>i; } vector<int>dp(1005); dp[0]=1; for(int i = 0;i<m;i++){ for(int j = 0;j<=1000;j++){ int x = b[i]+j; if(x<=1000){ if(dp[j]==1){ dp[x]=1; } } } } if(dp[a[0]]==1){ cout<<"YES"<<endl; } else{ cout<<"NO"<<endl; } } signed main(){ ios_base::sync_with_stdio(0); cin.tie(nullptr); // ll t;cin>>t;while(t--) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...