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>
#define ll long long
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define pb push_back
#define ertunt return
#define vodka void
using namespace std;
int main(){
ll n,m;
cin >> n >> m;
ll a;
cin >> a;
ll b[m+1];
for(ll j = 1; j <= m; j++)cin >> b[j];
for(ll i = 1; i <= (1<<m); i++){
ll res = 0;
for(ll j = 0; j < m; j++){
if(i&(1<<j)){
res+=b[j];
}
}
if(res == a){
cout << "YES";
ertunt 0;
}
}
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... |