#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n,m; cin>>n>>m; int num; cin>>num; vector<int>a(m);
for(int i=0; i<m; i++){
cin>>a[i];
}
bool ans=false;
for(int i=0; i<(1<<m); i++){
int sum=0;
for(int j=0; j<m; j++){
if(i&(1<<j)){
sum+=a[j];
}
}
if(sum==num)ans=true;
}
if(ans)cout<<"YES";
else cout<<"NO";
}
# | 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... |