Submission #825244

#TimeUsernameProblemLanguageResultExecution timeMemory
825244dijbkrBank (IZhO14_bank)C++14
0 / 100
1 ms320 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...