제출 #1137753

#제출 시각아이디문제언어결과실행 시간메모리
1137753varun312Snake Escaping (JOI18_snake_escaping)C++20
5 / 100
2096 ms2528 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define pb push_back #define mp make_pair #define fi first #define se second #define endl "\n" int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << fixed << setprecision(0); int l,q; cin >> l >> q; int n = (1 << l); string s; cin >> s; while (q--) { string a; cin >> a; int ans = 0; for (int i = 0; i < n; i++) { for (int bit = 0; bit < l; bit++) { if ((a[l-bit-1] != '?') && ((a[l-bit-1] == '1') != (bool)(i & (1 << bit)))) { // cout << "failed: " << bit << " " << (1 << bit) << " as" << i << endl; // cout << (i & (1 << bit)) << endl; goto nah; } } // cout << i << " "; ans += s[i]-'0'; nah: continue; } cout << ans << endl; } }
#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...