# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1270424 | michael12 | Bank (IZhO14_bank) | C++20 | 150 ms | 327680 KiB |
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
void setIO(string name = "") {
ios_base::sync_with_stdio(0);
cin.tie(0);
if (name.size()) {
freopen((name + ".in").c_str(), "r", stdin);
freopen((name + ".out").c_str(), "w", stdout);
}
}
int main(){
setIO("bank");
int n,m;
cin >> m >> n;
vector<int> a(n);
vector<int> v(m);
for(int i = 0; i < m; i++){
cin >> v[i];
}
for(int j = 0; j < n; j++){
cin >> a[j];
}
bool is = 0;
int ans = 0;
for(int i = 0; i < 1 << n; i++){
int s = 0;
for(int j = 0; j < n; j++){
if(i & 1 << j){
s += a[j];
}
}
if(v[0] == s){
is = 1;
}
}
if(is){
cout << "YES";
return 0;
}
else{
cout << "NO";
return 0;
}
}
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... |