제출 #936516

#제출 시각아이디문제언어결과실행 시간메모리
936516tamir1은행 (IZhO14_bank)C++14
19 / 100
69 ms600 KiB
#include<bits/stdc++.h> using namespace std; int n,m,a[30],b[30],i,j,x; int main(){ //freopen("bank.in","r",stdin); //freopen("bank.out","w",stdout); cin >> n >> m; for(i=0;i<n;i++) cin >> a[i]; for(i=0;i<m;i++) cin >> b[i]; if(n==1) x=a[0]; for(i=0;i<(1<<m);i++){ int sum=0; for(j=0;j<m;j++){ if(i&(1<<j)) sum+=b[j]; } if(sum==x){ 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...