제출 #1118014

#제출 시각아이디문제언어결과실행 시간메모리
1118014p4r4d0_x은행 (IZhO14_bank)C++14
19 / 100
61 ms508 KiB
#define _USE_MATH_DEFINES #include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #define PUT(a, b) freopen(a, "r", stdin); freopen(b, "w", stdout); #define all(a) a.begin(), a.end() #define answerNO {cout << "NO" << endl; return;} #define answerYES {cout << "YES" << endl; return;} #define ff first #define ss second #define pb push_back #define replr(i, a, b) for (int i = int(a); i <= int(b); ++i) #define reprl(i, a, b) for (int i = int(a); i >= int(b); --i) #define rep(i, n) for (int i = 0; i < int(n); ++i) #define mkp(a, b) make_pair(a, b) using namespace std; typedef __int128 ull; typedef long long ll; typedef long double ld; typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<PII> VPI; typedef pair<ll, ll> PLL; typedef vector<ll> VL; typedef vector<PLL> VPL; template<class T> T setmax(T& a, T b) {if (a < b) return a = b; return a;} template<class T> T setmin(T& a, T b) {if (a < b) return a; return a = b;} #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; template<class T> using indset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; ll mod = 1e9+7; void solve(){ ll n, m; cin >> n >> m; VL a(n), b(m); rep(i, n)cin >> a[i]; rep(i, m)cin >> b[i]; ll num = 0; bool ok = 0; for(int i = 0; i < (1 << m); ++i){ num = 0; for(int j = 0; j < m; ++j){ if(i & (1 << j)){ num += b[j]; } } if(num == a[0]){ ok = 1; } } if(ok)answerYES; answerNO; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL); //PUT("tttt.in", "tttt.out"); int t = 1; //cin >> t; while(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...