제출 #880119

#제출 시각아이디문제언어결과실행 시간메모리
880119boris_7은행 (IZhO14_bank)C++17
19 / 100
0 ms348 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; void solve(){ int n,m; cin>>n>>m; vector<int>a(n); vector<int>b(m); for(int &i:a){ cin>>i; } for(int &i:b){ cin>>i; } vector<int>dp(1005); dp[0]=1; for(int i = 0;i<m;i++){ for(int j = 1000;j>=0;j--){ int x = j+b[i]; if(x<=1000){ if(dp[j]==1){ dp[x]=1; } } } } if(dp[a[0]]==1){ cout<<"YES"<<endl; } else{ cout<<"NO"<<endl; } } signed main(){ ios_base::sync_with_stdio(0); cin.tie(nullptr); // ll t;cin>>t;while(t--) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...