Submission #100479

# Submission time Handle Problem Language Result Execution time Memory
100479 2019-03-11T14:43:40 Z 1Khan Bank (IZhO14_bank) C++14
0 / 100
3 ms 384 KB
/// 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 b[22];
int a[22];
int P;
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;
     for(int i = 1; i <= q; ++i){
          cin >> b[i];
     }
     if(q == 1){
          P = b[1];
     }
     for(int i = 1; i <= n; ++i){
          cin >> a[i];
     }
     if(q == 1){
          man(1, 0);
       cout << "NO";
     }
     cout << "NO";
     return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -