Submission #945400

#TimeUsernameProblemLanguageResultExecution timeMemory
945400KasymKBank (IZhO14_bank)C++17
19 / 100
26 ms348 KiB
#include "bits/stdc++.h" using namespace std; vector<int> a, b, vis; int n, m; void f(int cnt){ if(cnt == m - 1){ int sum = 0; for(int i = 0; i < m; ++i) if(vis[i]) sum += b[i]; if(sum == a.front()){ cout << "YES" << "\n"; exit(0); } return; } for(int i = 0; i <= 1; ++i){ vis[cnt] = i; f(cnt + 1); } } int main(){ cin >> n >> m; a.resize(n); b.resize(m); for(int &i : a) cin >> i; for(int &i : b) cin >> i; if(n == 1 and m <= 20){ vis.assign(m, 0); f(0); cout << "NO" << "\n"; } else cout << "yok" << "\n"; 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...