Submission #1027665

#TimeUsernameProblemLanguageResultExecution timeMemory
1027665vjudge1Bank (IZhO14_bank)C++17
0 / 100
1 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) { bool dp[m][plata[0]+1]; int pari[m]; memset(dp, 0, sizeof(dp)); for(int i=0; i<m; i++) { dp[i][0]=1; } for(int i=0; i<m; i++) { cin>>pari[i]; } for(int i=0; i<m; i++) { for(int j=1; j<=plata[0]; j++) { if(j-pari[i]>=0) { dp[i][j]=dp[i-1][j]+dp[i-1][j-pari[i]]; } else dp[i][j]=dp[i-1][j]; } } if(dp[m-1][plata[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...