Submission #1190965

#TimeUsernameProblemLanguageResultExecution timeMemory
1190965akbarr은행 (IZhO14_bank)C++17
19 / 100
60 ms328 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define run ios_base::sync_with_stdio(0);cin.tie(0); #define F first #define S second #define endl '\n' const int inf = 1e18+7; const int sz = 2e5+5; void solve() { //freopen("bank.in" , "r" , stdin); //freopen("bank.out" , "w" , stdout); int n,m; cin >> n >> m; vector<int>a(n),b(m); for(int i = 0;i < n;i++) cin >> a[i]; for(int i = 0; i < m;i++) cin >> b[i]; bool ok = false; for(int bt = 0;bt < 1 << m;bt++){ int cost = 0; for(int i = 0; i < m;i++){ if(bt & (1 << i)){ cost+=b[i]; } } if(cost == a[0]){ ok = true; break; } } if(ok){ cout << "YES" << endl; } else{ cout << "NO" << endl; } } signed main() { run; int t = 1; //cin >> t; while (t--) { solve(); } } // 11111100000
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...