Submission #656372

#TimeUsernameProblemLanguageResultExecution timeMemory
656372the_ilyasBank (IZhO14_bank)C++14
0 / 100
1 ms384 KiB
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() const int N = 100001; int dp[N]; signed main(){ ios::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; int A[n]; for(int i = 0; i < n; i++) { cin >> A[i]; } int M[m]; for(int i = 0; i < m; i++) cin >> M[i]; dp[0] = 1; for(int i = 1; i <= 10000; i++) { for(int j = 0; j < m; j++) { if(i - M[j] >= 0) { dp[i] = dp[i - M[j]]; } } } if(accumulate(dp, dp + N, 0) == n) 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...