Submission #636860

#TimeUsernameProblemLanguageResultExecution timeMemory
636860zeroesandonesBank (IZhO14_bank)C++17
19 / 100
67 ms324 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef vector<ll> vi; typedef pair<ll, ll> pi; #define FOR(i, j, k) for (ll i = j; i < (ll) k; ++i) #define FORD(i, j, k) for (ll i = j; i >= (ll) k; --i) #define nl "\n" #define sp " " #define all(x) (x).begin(), (x).end() #define sc second #define fr first #define pb push_back void solve() { int n, m; cin >> n >> m; int a[n]; FOR(i, 0, n) { cin >> a[i]; } int b[m]; FOR(i, 0, m) { cin >> b[i]; } bool pos = false; FOR(i, 0, (1<<m)) { ll sum = 0; FOR(j, 0, m) { if(i & (1<<j)) sum += b[j]; } pos |= (sum == a[0]); } cout << (pos ? "YES" : "NO") << nl; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll 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...