Submission #474851

#TimeUsernameProblemLanguageResultExecution timeMemory
474851ismoilovBank (IZhO14_bank)C++14
0 / 100
1 ms332 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); void S() { int n, m; cin >> n >> m; vector <int> a(m); int x = 0; for(int i = 0; i < m; i ++) cin >> a[i], x += a[i]; vector <int> b(x+1); b[0] = 1; for(int i = 0; i < m; i ++){ for(int j = 0; j <= x - a[i]; j ++) if(b[j] == 1) b[j+a[i]] = 1; } cout << (b[n] == 1 ? "YES" : "NO"); /*for(int i = 0; i < x; i ++) cout << b[i] << " ";*/ } int main() { IOS; /*int t; cin >> t; while(t --)*/ S(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...