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>
#include <cmath>
#include <algorithm>
#include <iomanip>
#define MAXN 100001
#define intt long long int
using namespace std;
intt x , y , a[MAXN] , b[MAXN] , ans = 0 ;
int main()
{
cin >> x >> y ;
for ( intt i = 0 ; i < x ; i ++ )
cin >> a[i] ;
for ( intt i = 0 ; i < y ; i ++ )
cin >> b[i] ;
for(intt i = 0; i < (1<<y); i++) {
intt c = 0;
for (intt j = 0; j < y; j++)
if (i & (1<<j)) c += b[j];
if (c==a[0]) ans = 1;
}
if(ans == 1) cout << "YES"<<endl;
else cout << "NO"<<endl;
return 0 ;
}
# | 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... |