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;
typedef long long ll;
#define fr first
#define sc second
#define vec vector
#define ret return
#define ins insert
#define mk make_pair
#define pb push_back
#define pii pair<int,int>
#define all(s) s.begin(), s.end()
#define allr(s) s.rbegin(), s.rend()
const int N = 2e5+12, INF = 1e9, mod = 1e9+7;
int a[N], b[N];
main(){
int n, m;
cin>>n>>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 ans = 0;
for(int i=0; i<m; i++){
if(mask & (1<<i)){
ans += b[i];
}
}
if(ans == a[1]){
cout<<"YES"<<endl;
return 0;
}
}
return 0;
}
Compilation message (stderr)
bank.cpp:22:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
22 | main(){
| ^~~~
# | 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... |