Submission #1089136

#TimeUsernameProblemLanguageResultExecution timeMemory
1089136vjudge1Bank (IZhO14_bank)C++17
19 / 100
2 ms476 KiB
#include <bits/stdc++.h> #define int long long #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() #define sz size() #define yes "YES" #define no "NO" #define IOI ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define pf push_front #define pb push_back #define S second #define F first using namespace std; const int N = 5000 + 5; const int NN = 20; const int mod = (1e9 + 7); const int inf = 1e18; int was[N], a[N]; int x, n, m; void rec(int val, int l) { if (val > x) return; was[val] = 1; for (int i = l; i <= m; i++) { rec(val + a[i], i + 1); } return; } void legenda_ne_umret() { cin >> n >> m; cin >> x; for (int i = 1; i <= m; i++) { cin >> a[i]; } for (int i = 1; i <= m; i++) { rec(a[i], i + 1); } if (was[x] == 1) cout << yes; else cout << no; } signed main() { IOI; // freopen("maze.in", "r", stdin); // freopen("maze.out", "w", stdout); ///////////////////////////////////////////// int t = 1; // cin >> t; for (int i = 1; i <= t; i++) { // cout << "Case " << i << ":\n"; legenda_ne_umret(); // cout << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...