Submission #881101

#TimeUsernameProblemLanguageResultExecution timeMemory
881101Hovhannes1234Bank (IZhO14_bank)C++17
0 / 100
6 ms348 KiB
#include <bits/stdc++.h> using namespace std; const int N=22; int a[N], b[N]; int main() { int n,m; cin>>n>>m; bool flag=false; for(int i=1; i<=n; i++)cin>>a[i]; for(int i=1; i<=m; i++)cin>>b[i]; for(int c=1; c<=n; c++){ for(int i=1; i<=(1<<20); i++){ long long ans=0; for(int j=0; j<n; j++){ if(i & (1<<j)){ ans+=(1<<i); } } if(ans==a[c]){ flag=true; break; } ans=0; } if(!flag){ cout<<"NO"<<"\n"; return 0; } cout<<"YES"<<"\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...