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;
// #pragma GCC optimize("Ofast, unroll-loops")
// #pragma GCC target("avx2,fma")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,sse4a,abm,mmx,avx,popcnt,tune=native")
// #pragma GCC optimize("inline")
// #pragma GCC optimize("-fgcse,-fgcse-lm")
// #pragma GCC optimize("-ftree-pre,-ftree-vrp")
// #pragma GCC optimize("-ffast-math")
// #pragma GCC optimize("-fipa-sra")
// #pragma GCC optimize("-fpeephole2")
// #pragma GCC optimize("-fsched-spec")
// #pragma GCC optimize("Ofast,no-stack-protector")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,popcnt,tune=native")
// #pragma GCC optimize("unroll-loops")
#define int long long
using ll = int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vb = vector<bool>;
using vpii = vector<pii>;
using vs = vector<string>;
#define cupsize \
ios_base::sync_with_stdio(false); \
cin.tie(nullptr); \
cout.tie(nullptr);
#define pb push_back
#define st first
#define nd second
#define all(x) x.begin() + 1, x.end()
#define sz(x) (ll) x.size()
#define watch(x) (cout << #x << " == " << x << '\n')
const int maxn = 2e5 + 7;
const int maxn2 = 1e5 + 7;
const int mod = 1e9 + 7;
const int mod2 = (119 << 23) + 1; // 998244353
const int inf = 1e18;
const int iinf = 1e9;
const double eps = 1e-7;
const int block = 350;
void mtests(auto x)
{
int tests;
cin >> tests;
while (tests--)
{
x();
}
}
template <typename T>
void readv(vector<T> &v, int from = 0)
{
for (size_t i = from; i < v.size(); ++i)
{
cin >> v[i];
}
}
template <typename T>
void printv(vector<T> &v, int from = 0)
{
for (size_t i = from; i < v.size(); ++i)
{
cout << v[i] << ' ';
}
}
void precalc()
{
}
int a[maxn2];
int b[maxn2];
void solve()
{
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; ++i)
{
cin >> a[i];
}
for (int i = 1; i <= m; ++i)
{
cin >> b[i];
}
if (n == 1)
{
for (int mask = 0; mask < (1 << m); ++mask)
{
int sum = 0;
for (int i = 0; i < m; ++i)
{
if ((1 << i) & mask)
{
sum += b[i + 1];
}
}
if (sum == a[1])
{
cout << "YES";
return;
}
}
cout << "NO";
}
}
int32_t main()
{
cupsize;
precalc();
// mtests(solve);
solve();
}
Compilation message (stderr)
bank.cpp:49:13: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
49 | void mtests(auto x)
| ^~~~
# | 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... |