이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |