Submission #100479

#TimeUsernameProblemLanguageResultExecution timeMemory
1004791KhanBank (IZhO14_bank)C++14
0 / 100
3 ms384 KiB
/// 1n the name of GOD #include <bits/stdc++.h> using namespace std; #define ko exit(0); #define nl '\n' #define ios ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0); #define sz(s) (int)s.size() #define all(s) s.begin(), s.end() #define oll(s, n, c) (s) + (c), s + (n) + c #define pb push_back #define ff first #define ss second #define pii pair<int, int> typedef long long ll; typedef double db; const int N = 1e5 + 111; const int M = 1e9 + 7; int q, n; int b[22]; int a[22]; int P; void man(int id, int S){ if(S >= P || id > n){ if(S == P){ cout << "YES"; exit(0); } return; } man(id + 1, S + a[id]); man(id + 1, S); } int main(){ ios cin >> q >> n; for(int i = 1; i <= q; ++i){ cin >> b[i]; } if(q == 1){ P = b[1]; } for(int i = 1; i <= n; ++i){ cin >> a[i]; } if(q == 1){ man(1, 0); cout << "NO"; } 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...