Submission #829040

#TimeUsernameProblemLanguageResultExecution timeMemory
829040makanhuliaBank (IZhO14_bank)C++17
46 / 100
91 ms664 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; int n, m; int a[25], b[25]; set<int> st; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 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 i2 = i, tmp=0; for(int j=0; j<m; j++){ if((i2 & (1<<j)) != 0) tmp += b[j]; } st.insert(tmp); } bool flag = 1; for(int i=0; i<n; i++){ if(!st.count(a[i])){ flag = 0; } } if(flag) cout<<"YES\n"; else cout<<"NO\n"; 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...