제출 #1107041

#제출 시각아이디문제언어결과실행 시간메모리
1107041vjudge1은행 (IZhO14_bank)C++17
19 / 100
8 ms29192 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template<class T> using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; #define pb push_back #define sz size() #define in insert #define int long long #define F first #define up upper_bound #define S second #define lb lower_bound #define pair pair<int, int> #define all(v) v.begin(),v.end() #define FOR1(x, n) for(int j = x; j <= n; j ++) #define FOR(x, n) for(int i = x; i <= n; i ++) #define FORR(x, n) for(int i = x; i >= n; i --) #define nikita ios_base::sync_with_stdio(0), cin.tie(0); int n,m,k,t,ans=0,sum=0,cnt, l, r, x, y, q; const int N = 1e6+5; int a[N], b[N], c[N]; vector<int>g[N]; int pref[N]; bool f = 0; void rec(int sum = 0, int i = 1){ if(sum == x)f=1; if(i > m)return; rec(sum, i+1), rec(sum+b[i], i+1); } void solve() { nikita cin >> n >> m; FOR(1, n)cin >> x; FOR(1, m)cin >> b[i]; rec(); if(!f)cout << "NO\n"; else cout << "YES\n"; } signed main() { nikita int t=1; FOR(1, t)solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...