Submission #956170

# Submission time Handle Problem Language Result Execution time Memory
956170 2024-04-01T08:40:13 Z samvar_0907 Snake Escaping (JOI18_snake_escaping) C++17
5 / 100
2000 ms 5280 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

signed main(){
    int l, q;
    cin >> l >> q;
    string toxicities;
    cin >> toxicities;

    while (q--){

        string s;
        cin >> s;

        int ans = 0;

        for (int bm = 0; bm < (1 << l); bm++){
            bool add = true;
            for (int i = l - 1; i >= 0; i--){
                if (s[i] == '0' || s[i] == '1'){
                    int s_digit = s[i] - '0';
                    int bm_bit = (bm >> (l - i - 1)) & 1;
                    if (s_digit != bm_bit) {
                        add = false;
                        break;
                    }
                }
            }
            if (add){
                ans += toxicities[bm]-'0';
            }
        }
        cout << ans << endl;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 7 ms 344 KB Output is correct
3 Correct 6 ms 348 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 8 ms 344 KB Output is correct
6 Correct 7 ms 348 KB Output is correct
7 Correct 7 ms 348 KB Output is correct
8 Correct 10 ms 348 KB Output is correct
9 Correct 4 ms 348 KB Output is correct
10 Correct 7 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 7 ms 344 KB Output is correct
3 Correct 6 ms 348 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 8 ms 344 KB Output is correct
6 Correct 7 ms 348 KB Output is correct
7 Correct 7 ms 348 KB Output is correct
8 Correct 10 ms 348 KB Output is correct
9 Correct 4 ms 348 KB Output is correct
10 Correct 7 ms 348 KB Output is correct
11 Execution timed out 2057 ms 5280 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 7 ms 344 KB Output is correct
3 Correct 6 ms 348 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 8 ms 344 KB Output is correct
6 Correct 7 ms 348 KB Output is correct
7 Correct 7 ms 348 KB Output is correct
8 Correct 10 ms 348 KB Output is correct
9 Correct 4 ms 348 KB Output is correct
10 Correct 7 ms 348 KB Output is correct
11 Execution timed out 2057 ms 5280 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 7 ms 344 KB Output is correct
3 Correct 6 ms 348 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 8 ms 344 KB Output is correct
6 Correct 7 ms 348 KB Output is correct
7 Correct 7 ms 348 KB Output is correct
8 Correct 10 ms 348 KB Output is correct
9 Correct 4 ms 348 KB Output is correct
10 Correct 7 ms 348 KB Output is correct
11 Execution timed out 2017 ms 3604 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 7 ms 344 KB Output is correct
3 Correct 6 ms 348 KB Output is correct
4 Correct 6 ms 344 KB Output is correct
5 Correct 8 ms 344 KB Output is correct
6 Correct 7 ms 348 KB Output is correct
7 Correct 7 ms 348 KB Output is correct
8 Correct 10 ms 348 KB Output is correct
9 Correct 4 ms 348 KB Output is correct
10 Correct 7 ms 348 KB Output is correct
11 Execution timed out 2057 ms 5280 KB Time limit exceeded
12 Halted 0 ms 0 KB -