# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
973771 | Bilal_Coder | Bank (IZhO14_bank) | C++17 | 161 ms | 600 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;
int main()
{
int n , m;
scanf("%d %d" , &n , &m);
vector<int> a(n) , b(m);
vector<bool> used(m , true);
for (auto & x : a)scanf("%d" , &x);
for (auto & x : b)scanf("%d" , &x);
for (auto x : a){
bool flag = false;
for (int mask = 0; mask < (1 << m); mask++){
int sum = 0;
vector<int> v;
for (int i = 0; i < m; i++)
if (mask & (1 << i) and used[b[i]]){
sum += b[i];
v.push_back(b[i]);
}
if (sum == x){
for (auto xx : v)used[xx] = false;
flag = true;
break;
}
}
if (!flag){
puts("NO");
return 0;
}
}
puts("YES");
}
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... |