# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
781678 | rahidilbayramli | Bank (IZhO14_bank) | C++17 | 66 ms | 340 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define all(v) v.begin(), v.end()
#define pb push_back
#define f first
#define s second
#define pii pair<int, int>
#define pll pair<ll, ll>
using namespace std;
int main()
{
ll n, m, i, j, p = 1, k, q, sum = 0;
cin >> n >> m;
vl v(n);
for(ll&h : v)
cin >> h;
vl a(m);
for(ll&h : a)
cin >> h;
bool f = false;
for(i = 0; i < (1 << m); i++)
{
sum = 0;
for(j = 0; j < m; j++)
{
if((i & (1 << j)) != 0)
sum += a[j];
}
if(sum == v[0])
f = true;
}
if(f)
cout << "YES\n";
else
cout << "NO\n";
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |