| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 521885 | Monarchuwu | Snake Escaping (JOI18_snake_escaping) | C++17 | 2067 ms | 3736 KiB | 
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>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
const int N = 2e6 + 4;
int l, q;
string s;
bool check(int mask, string s) {
    for (int i = 0; i < l; ++i) {
        char c = s[s.size() - 1 - i];
        if (c != '?') {
            if (c == '1') {
                if (!(mask >> i & 1)) return false;
            }
            else {
                if (mask >> i & 1) return false;
            }
        }
    }
    return true;
}
int main() {
    cin.tie(NULL)->sync_with_stdio(false);
    cin >> l >> q >> s;
    while (q--) {
        string t; cin >> t;
        int sum(0);
        for (int i = 0; i < s.size(); ++i)
            if (check(i, t)) sum += s[i] ^ 48;
        cout << sum << '\n';
    }
}
/**  /\_/\
 *  (= ._.)
 *  / >0  \>1
**/
Compilation message (stderr)
| # | 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... | ||||
