Submission #502459

#TimeUsernameProblemLanguageResultExecution timeMemory
502459zoriankaSnake Escaping (JOI18_snake_escaping)C++17
12 / 100
2069 ms65540 KiB
//#pragma GCC optimize("O3,unroll-loops") //#pragma GCC optimize("fast-math") //#pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> using namespace std; using ll = long long; void solve() { int l, q; cin >> l >> q; string s; cin >> s; unordered_map<string, int> d; for (int i = 0; i < (1 << l); i++) { for (int mask = 0; mask < (1 << l); mask++) { string t = ""; for (int j = l - 1; j > -1; j--) { if (mask & (1 << j)) t += '?'; else t += '0' + ((i & (1 << j)) != 0); } d[t] += s[i] - '0'; } } while (q--){ string t; cin >> t; cout << d[t] << '\n'; } } signed main() { #ifdef LOCAL freopen("input.txt", "r", stdin); #endif int t = 1; // cin >> t; while (t--) solve(); 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...