# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
655540 | iskhakkutbilim | Bank (IZhO14_bank) | C++14 | 1 ms | 212 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 int long long
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
const int M = 1e9 + 7;
const int N = 1e6 + 1;
main(){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
ifstream cin("bank.in");
ofstream cout("bank.out");
int n, m; cin >> n >> m;
int a[n], b[m];
for(int i = 0;i < n; i++){
cin >> a[i];
}
for(int i = 0;i < m; i++){
cin >> b[i];
}
for(int mask = 0; mask < (1<<m); mask++){
int sum = 0;
for(int i = 0;i < m; i++){
if(mask & (1<<i)){
sum+= b[i];
}
}
if(sum == a[0]){
cout << "YES";
return 0;
}
}
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... |