This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |