제출 #691735

#제출 시각아이디문제언어결과실행 시간메모리
691735saayan007은행 (IZhO14_bank)C++17
19 / 100
61 ms340 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using pi = pair<int, int>; using pl = pair<long long, long long>; using vi = vector<int>; using vl = vector<long long>; using vpi = vector<pair<int, int>>; using vpl = vector<pair<long long, long long>>; #define fur(i, a, b) for(ll i = a; i <= (ll)b; ++i) #define ruf(i, a, b) for(ll i = a; i >= (ll)b; --i) #define fr first #define sc second #define mp make_pair #define pb emplace_back #define nl "\n" #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() int main() { ios::sync_with_stdio(0); cin.tie(0); ll n, m; cin >> n >> m; ll a[n], b[m]; fur(i, 0, n - 1) { cin >> a[i]; } fur(i, 0, m - 1) { cin >> b[i]; } fur(i, 0, (1 << m) - 1) { ll amt = 0; fur(j, 0, m - 1) { if(i & (1 << j)) { amt += b[j]; } } if(amt == a[0]) { cout << "YES" << nl; return 0; } } cout << "NO" << nl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...