Submission #972193

#TimeUsernameProblemLanguageResultExecution timeMemory
972193AikaBank (IZhO14_bank)C++14
19 / 100
1 ms448 KiB
#include <bits/stdc++.h> #define int long long #define aiiiii ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); using namespace std; signed main(){ aiiiii int n, k, m, i, j; cin>>n>>m; int a[n], b[m]; for(i=0;i<n;i++){ cin>>a[i]; } for(i=0;i<m;i++){ cin>>b[i]; } bool a1=0; int ans[a[0]+1]; for(i=1;i<=a[0];i++){ ans[i]=10001; } ans[0]=0; for(j=0;j<m;j++){ for(int r=a[0];r>=0;r--){ if(ans[r]!=10001&&r+b[j]<=a[0])ans[r+b[j]]=min(ans[r+1],ans[r]+1); } } if(ans[a[0]]!=10001)cout<<"YES"<<endl; else cout<<"NO"<<endl; }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:8:12: warning: unused variable 'k' [-Wunused-variable]
    8 |     int n, k, m, i, j;
      |            ^
bank.cpp:17:7: warning: unused variable 'a1' [-Wunused-variable]
   17 |  bool a1=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...