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 ull unsigned long long
void solve(){
long long n,m,x;
cin>>n>>m;
if(n == 1){
cin>>x;
vector<long long>v(m);
for(long long i = 0;i<m;i++){
cin>>v[i];
}
bool g = false;
for(long long i = 1;i<(1<<m);i++){
long long sum = 0;
for(long long j = 0;j<m;j++){
sum+=(((1<<j)&i)>0)*v[j];
}
if(sum == x){
g = true;
break;
}
}
if(g){
cout<<"YES\n";
}
else{
cout<<"NO\n";
}
}
else{
cout<<"NO\n";
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
//cin>>t;
while(t--){
solve();
}
}
# | 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... |