Submission #1082285

#TimeUsernameProblemLanguageResultExecution timeMemory
1082285MalixBank (IZhO14_bank)C++14
19 / 100
1 ms436 KiB
#include <bits/stdc++.h> using namespace std; #define REP(a,b,c) for(int a=b;a<c;a++) #define F first #define S second #define PB push_back #define LSOne(s) ((s)&(-s)) typedef long long ll; typedef vector<int> vi; typedef vector<vi> vii; typedef pair<ll,int> pi; typedef vector<pi> pii; ll M=1000000007; ll INF=1000000000000000010; int inf=1000000010; int main(){ int n,m;cin>>n>>m; vi a(n),b(m); REP(i,0,n)cin>>a[i]; REP(i,0,m)cin>>b[i]; vi dp(a[0]+1,0); dp[0]=1; REP(j,0,m)for(int i=a[0];i>=0;i--)if(dp[i]==1&&i+b[j]<=a[0])dp[i+b[j]]=1; if(dp[a[0]]==1)cout<<"YES"; else cout<<"NO"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...