Submission #884199

#TimeUsernameProblemLanguageResultExecution timeMemory
884199kokoueBank (IZhO14_bank)C++14
0 / 100
0 ms348 KiB
#include<bits/stdc++.h> using namespace std; bool sum[20001]; int n,m; int a[100],b[100]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin>>n>>m; for(int i=0;i<n;i++) { cin>>a[i]; } for(int i=0;i<m;i++) { cin>>b[i]; } sum[a[0]]=1; int maxsum=a[0]; for(int i=0;i<m;i++) { sum[a[i]]=true; for(int j=a[0];j<=maxsum;j++) { if(sum[j] && i!=j) { maxsum=max(maxsum,i+a[i]); sum[j+a[i]]=true; } } } // for(int i=0;i<=maxsum;i) for(int i=0;i<n;i++) { if(!sum[a[i]]) {cout<<"NO\n";return 0;} } cout<<"YES\n"; 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...