제출 #965394

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
9653942024-04-18 12:36:25four_specksSnake Escaping (JOI18_snake_escaping)C++17
22 / 100
337 ms65536 KiB
#include <bits/stdc++.h>
using namespace std;
namespace {}
void solve() {
int h, q;
cin >> h >> q;
uint32_t n = 1 << h;
string a;
cin >> a;
vector dp_sub(n, vector<int>(h + 1)), dp_super(n, vector<int>(h + 1));
for (uint32_t x = 0; x < n; x++) {
dp_sub[x][0] = a[x] - '0';
for (int s = 0; s < h; s++) {
dp_sub[x][s + 1] = dp_sub[x][s];
if (x >> s & 1) {
dp_sub[x][s + 1] += dp_sub[x ^ (1u << s)][s];
}
}
}
for (uint32_t x = n - 1; x + 1 > 0; x--) {
dp_super[x][0] = a[x] - '0';
for (int s = 0; s < h; s++) {
dp_super[x][s + 1] = dp_super[x][s];
if (!(x >> s & 1)) {
dp_super[x][s + 1] += dp_super[x | (1u << s)][s];
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...