# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
936515 | tamir1 | Bank (IZhO14_bank) | C++14 | 1 ms | 348 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 n,m,a[30],b[30],i,j,x;
int main(){
freopen("bank.in","r",stdin);
freopen("bank.out","w",stdout);
cin >> n >> m;
for(i=0;i<n;i++) cin >> a[i];
for(i=0;i<m;i++) cin >> b[i];
if(n==1) x=a[0];
for(i=0;i<(1<<m);i++){
int sum=0;
for(j=0;j<m;j++){
if(i&(1<<j)) sum+=b[j];
}
if(sum==x){
cout << "YES";
return 0;
}
}
cout << "NO";
}
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... |