제출 #595838

#제출 시각아이디문제언어결과실행 시간메모리
595838Belphegor은행 (IZhO14_bank)C++14
19 / 100
60 ms340 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; int A[22],B[22]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n,m; cin>>n>>m; for(int i=0; i<n; i++) cin>>A[i]; for(int i=0; i<m; i++) cin>>B[i]; for(int i=1; i<(1<<m); i++){ int tot = 0; for(int j=0; j<m; j++) if(i&(1<<j)) tot+=B[j]; if(A[0]==tot){ cout<<"YES"; return 0; } } 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...