Submission #1319580

#TimeUsernameProblemLanguageResultExecution timeMemory
1319580yessimkhanBank (IZhO14_bank)C++20
19 / 100
0 ms332 KiB
#include <bits/stdc++.h> #define ll long long #define ent '\n' #define pb push_back #define all(x) x.begin(),x.end() #define PRaim_bek_abi ios_base::sync_with_stdio(0);cin.tie(0); using namespace std; const int N = 1e5+5; const int MOD = 1e9+7; int n , m , b[N] , a[N]; bool dp[N]; void easy(){ 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 = a[1]; j >= b[i]; j--){ if (dp[j - b[i]] == 1) dp[j] = 1; } } cout << (dp[a[1]] == 1 ? "YES" : "NO"); } signed main(){ PRaim_bek_abi int t=1; //cin>>t; while(t--) easy(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...