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 <iostream>
using namespace std;
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
fastIO;
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 i=0; i<(1<<m); i++){
int cur = 0;
for(int j=0; j<m; j++){
if(i&(1<<j)) cur += a[j];
}
if(cur==a[0]){
cout << "YES" << '\n';
return 0;
}
}
cout << "NO" << '\n';
}
# | 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... |