Submission #1115339

#TimeUsernameProblemLanguageResultExecution timeMemory
1115339staszic_ojuzSnake Escaping (JOI18_snake_escaping)C++17
5 / 100
2049 ms10404 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...