# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
516681 | Skurrl | Bank (IZhO14_bank) | C++17 | 69 ms | 308 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>
using namespace std;
#define pb push_back
#define N 100005
#define MOD 998244353
#define endl '\n'
#define all(x) x.begin(), x.end()
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
const ll inf = 1e17;
void solve()
{
int n, m; cin >> n >> m;
vi a(n), b(m);
for(auto &i : a) cin >> i;
for(auto &i : b) cin >> i;
if(n == 1)
{
ll sum = a[0];
ll size = pow(2, m);
for (int i = 0; i < size; ++i)
{
ll cur = 0;
for(int j = 0; j < m; ++j)
{
if(i & (1 << j))
{
cur += b[j];
}
}
if(cur == sum)
{
cout << "YES";
return;
}
}
}
else
{
"nosol";
return;
}
cout << "NO";
return;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
//ll t; cin >> t;
//while(t--)
solve();
}
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... |