제출 #100476

#제출 시각아이디문제언어결과실행 시간메모리
1004761Khan은행 (IZhO14_bank)C++14
19 / 100
7 ms384 KiB
/// 1n  the  name  of  GOD

#include <bits/stdc++.h>
using   namespace        std;

#define ko               exit(0);
#define nl               '\n'
#define ios              ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define sz(s)            (int)s.size()
#define all(s)           s.begin(), s.end()
#define oll(s, n, c)     (s) + (c), s + (n) + c
#define pb               push_back
#define ff               first
#define ss               second
#define pii              pair<int, int>

typedef long long ll;
typedef double db;

const int N = 1e5 + 111;
const int M = 1e9 + 7;

int q, n;
int P;
int a[22];

void man(int id, int S){
     if(S >= P || id > n){
          if(S == P){
               cout << "YES";
               exit(0);
          }
          return;
     }
     man(id + 1, S + a[id]);
     man(id + 1, S);
}
int main(){
     ios

     cin >> q >> n;
     cin >> P;
     for(int i = 1; i <= n; ++i){
          cin >> a[i];
     }
     man(1, 0);
     cout << "NO";
     return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...