Submission #1102413

# Submission time Handle Problem Language Result Execution time Memory
1102413 2024-10-18T05:10:24 Z _8_8_ Snake Escaping (JOI18_snake_escaping) C++17
5 / 100
2000 ms 8500 KB
#include <bits/stdc++.h>
    
using namespace std;
    
typedef long long ll;
    
const int  N = (1 << 20) + 12, MOD = 998244353;

int n, q;
string s;
void test() {
    cin >> n >> q;
    cin >> s;
    while(q--) {
        string t;
        cin >> t;
        reverse(t.begin(), t.end());
        int res = 0;
        for(int i = 0; i < (1 << n); i++) {
            bool ok = 1;
            for(int j = 0; j < n; j++) {
                if(t[j] == '?') continue;
                int x = (t[j] - '0');
                if(x != ((i >> j) & 1)) {
                    ok = 0;
                    break;
                }
            }
            if(ok) {
                res += (s[i] - '0');
            }
        }
        cout << res << '\n';
    }
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); 
    
    int t = 1; 
    // cin >> t;
    
    while(t--) 
        test();
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 336 KB Output is correct
2 Correct 4 ms 340 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 4 ms 508 KB Output is correct
5 Correct 5 ms 340 KB Output is correct
6 Correct 4 ms 468 KB Output is correct
7 Correct 4 ms 340 KB Output is correct
8 Correct 8 ms 340 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 5 ms 508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 336 KB Output is correct
2 Correct 4 ms 340 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 4 ms 508 KB Output is correct
5 Correct 5 ms 340 KB Output is correct
6 Correct 4 ms 468 KB Output is correct
7 Correct 4 ms 340 KB Output is correct
8 Correct 8 ms 340 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 5 ms 508 KB Output is correct
11 Execution timed out 2045 ms 8500 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 336 KB Output is correct
2 Correct 4 ms 340 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 4 ms 508 KB Output is correct
5 Correct 5 ms 340 KB Output is correct
6 Correct 4 ms 468 KB Output is correct
7 Correct 4 ms 340 KB Output is correct
8 Correct 8 ms 340 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 5 ms 508 KB Output is correct
11 Execution timed out 2045 ms 8500 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 336 KB Output is correct
2 Correct 4 ms 340 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 4 ms 508 KB Output is correct
5 Correct 5 ms 340 KB Output is correct
6 Correct 4 ms 468 KB Output is correct
7 Correct 4 ms 340 KB Output is correct
8 Correct 8 ms 340 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 5 ms 508 KB Output is correct
11 Execution timed out 2028 ms 4848 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 336 KB Output is correct
2 Correct 4 ms 340 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 4 ms 508 KB Output is correct
5 Correct 5 ms 340 KB Output is correct
6 Correct 4 ms 468 KB Output is correct
7 Correct 4 ms 340 KB Output is correct
8 Correct 8 ms 340 KB Output is correct
9 Correct 3 ms 340 KB Output is correct
10 Correct 5 ms 508 KB Output is correct
11 Execution timed out 2045 ms 8500 KB Time limit exceeded
12 Halted 0 ms 0 KB -