Submission #1102413

#TimeUsernameProblemLanguageResultExecution timeMemory
1102413_8_8_Snake Escaping (JOI18_snake_escaping)C++17
5 / 100
2045 ms8500 KiB
#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 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...