제출 #968696

#제출 시각아이디문제언어결과실행 시간메모리
968696HaciyevAlik은행 (IZhO14_bank)C++14
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define oo 100000000000 const int sz=21; int a[sz],b[sz]; bool dp[1005]; signed main() { ios::sync_with_stdio(false); cin.tie(0); int n,m; cin >> n >> m; for(int i=1;i<=n;++i) { cin >> a[i]; } for(int i=1;i<=m;++i) { cin >> b[i]; } dp[0]=1; for(int i=1;i<=m;++i) { for(int j=b[i];j<=a[1];++j) { if(dp[j-b[i]]) { dp[j]=1; } } } if(dp[a[1]]) { cout << "YES"; } else { cout << "NO"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...