제출 #1089117

#제출 시각아이디문제언어결과실행 시간메모리
1089117vjudge1은행 (IZhO14_bank)C++17
19 / 100
2 ms348 KiB
#include <bits/stdc++.h> //qwerty47924692 using namespace std; using ll = long long; #define f first #define s second const ll N=3e5+29; ll n,m,a[N],b[N],ans; void f(ll x,ll sum){ if(x==m){ if(sum==a[1])ans=1; return; } x++; f(x,sum+b[x]); f(x,sum); } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin>>n>>m; for(ll i=1;i<=n;i++){ cin>>a[i]; } for(ll i=1;i<=m;i++){ cin>>b[i]; } f(0,0); cout<<(ans ? "YES" : "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...