Submission #880119

#TimeUsernameProblemLanguageResultExecution timeMemory
880119boris_7Bank (IZhO14_bank)C++17
19 / 100
0 ms348 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 = 1000;j>=0;j--){ int x = j+b[i]; 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...