Submission #802930

#TimeUsernameProblemLanguageResultExecution timeMemory
802930VMaksimoski008은행 (IZhO14_bank)C++14
19 / 100
46 ms300 KiB
#include <bits/stdc++.h> #define pb push_back #define eb emplace_back #define sz(x) (int)x.size() #define all(x) x.begin(), x.end() #define uniq(x) x.erase(unique(all(x)), x.end()) #define rall(x) x.rbegin(), x.rend() #define each(x, v) for(auto &x : v) #define mp make_pair using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using str = string; using pii = pair<int, int>; using pll = pair<ll, ll>; const int mod = 1e9 + 7; const int LOG = 20; const int maxn = 1e5 + 5; void setIO() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); } int32_t main() { setIO(); int n, m; cin >> n >> m; vector<int> people(n), money(m); for(int &x : people) cin >> x; for(int &x : money) cin >> x; //let's try the subtasks first :) //subtask 1 if(n == 1) { for(int s=0; s<(1<<m); s++) { int total = 0; for(int j=0; j<m; j++) if(s & (1 << j)) total += money[j]; if(total == people.back()) { cout << "YES\n"; return 0; } } cout << "NO\n"; return 0; } 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...