Submission #825244

# Submission time Handle Problem Language Result Execution time Memory
825244 2023-08-14T16:08:46 Z dijbkr Bank (IZhO14_bank) C++14
0 / 100
1 ms 320 KB
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

int main() {
   ios_base::sync_with_stdio(false);
   cin.tie(NULL); cout.tie(NULL);
   int n,m;
   cin >> n >> m;
   int k;
   cin >> k;
   int a[m+1];
   for (int i=1; i<=m; i++) {
      cin >> a[i];
   }
   int dp[k+1];
   memset(dp,0,sizeof(dp));
   for (int i=1; i<=m; i++) {
      if (a[i]<=k) {
         dp[a[i]]=1;
      }
   }
   dp[0]=1;
   for (int i=1; i<=k; i++) {
      for (int j=1; j<=n; j++) {
         if (i-a[j]>=0) {
            if (dp[i-a[j]]) {
               dp[i]=1;
            }
         }
      }
   }
   if (dp[k]) {
      cout << "YES";
   } else {
      cout << "NO";
   }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 320 KB Output isn't correct
2 Halted 0 ms 0 KB -