Submission #1027657

#TimeUsernameProblemLanguageResultExecution timeMemory
1027657vjudge1Bank (IZhO14_bank)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin>>n>>m; int plata[n]; for(int i=0; i<n; i++) { cin>>plata[i]; } if(n==1) { int dp[1003], pari[m]; for(int i=0; i<1003; i++) dp[i]=i; for(int i=0; i<m; i++) { cin>>pari[i]; dp[pari[i]]=0; } for(int i=1; i<=plata[0]; i++) { if(!dp[i]) continue; for(int j=0; j<m; j++) { if(i-pari[j]>=1) { dp[i]=min(dp[i], dp[i-pari[j]]); } } } if(dp[plata[0]==0]) cout<<"YES"; else 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...