Submission #344291

#TimeUsernameProblemLanguageResultExecution timeMemory
344291katearimaBank (IZhO14_bank)C++14
19 / 100
1 ms368 KiB
#include <bits/stdc++.h> using namespace std; const int N=25; const int M=1005; int n, m, a[N], b[N], dp[M] , mx; main(){ cin>>n>>m; for(int i=0; i<n; i++){ cin>>a[i]; mx=max(mx, a[i]); } //n=1; for(int i=0; i<m; i++){ cin>>b[i]; } dp[0]=1; for(int i=0; i<m; i++){ for(int j=mx; j>=0; j--){ if(j-b[i]<0) continue; dp[j]+=dp[j-b[i]]; } } for(int i=0; i<n; i++) if(dp[a[i]]>0) cout<<"YES"<<endl; else cout<<"NO"<<endl; }

Compilation message (stderr)

bank.cpp:6:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...