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 <iostream>
using namespace std;
int main(){
int l, q;
cin>>l>>q;
string s;
cin>>s;
int n=1;
for (int i=0;i<l;i++) n<<=1;
for (int qe=0;qe<q;qe++){
string qs;
cin>>qs;
int x1=0, x2=0;
for (char c:qs){
if (c=='1') x1|=1;
if (c=='0') x2|=1;
x1<<=1;
x2<<=1;
}
x1>>=1;
x2>>=1;
int out=0;
for (int i=0;i<n;i++){
if ((i&x1)==x1&&((~i)&x2)==x2){
out+=s[i]-'0';
}
}
cout<<out<<'\n';
}
return 0;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |