제출 #765627

#제출 시각아이디문제언어결과실행 시간메모리
765627edfearay11은행 (IZhO14_bank)C++17
44 / 100
1002 ms316 KiB
#include<bits/stdc++.h> using namespace std; #define f(i,a,b) for(int i=a;i<b;i++) #define af(i,a,b) for(int i=a;i>=b;i--) #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define PB push_back #define MP make_pair #define F first #define S second typedef long long int ll; typedef pair<ll,ll> pll; typedef pair<int,int> pii; const ll mod=1e9+7; const int maxN=2e5+5; const ll inf=1e12; int n,m; vector<int> v,u; bool xx=false; int vis[30]; void prob(int i, int j){ /*f(l,0,n){ cout<<v[l]<<" "; } cout<<"\n"; f(l,0,m){ cout<<vis[l]<<" "; } cout<<"\n"; */ if(i==n){ xx=true; return; } if(v[i]==0){ f(x,0,m) prob(i+1,x); return; } if(vis[j]==1) return; if(v[i]<u[j]) return; vis[j]=1; v[i]-=u[j]; f(x,j+1,m){ prob(i,x); } v[i]+=u[j]; vis[j]=0; } void go(){ cin>>n>>m; int a; f(i,0,n){ cin>>a; v.PB(a); } f(i,0,m){ cin>>a; u.PB(a); } u.PB(0); m++; f(i,0,m) prob(0,i); if(xx) cout<<"YES\n"; else cout<<"NO\n"; } int main(){ fastio; int test=1; //cin>>test; f(i,1,test+1){ //cout<<"Case "<<i<<":\n"; go(); } 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...