# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
64590 | keko37 | Snake Escaping (JOI18_snake_escaping) | C++14 | 1944 ms | 51616 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<iostream>
#include<cstdio>
using namespace std;
const int MAXN = (1<<20) + 5;
int n, q, a, b, c, sol, mask, N, rev, count, i, j, tc;
char ss[MAXN];
char l[30], cc;
int val[MAXN], sum0[MAXN], sum1[MAXN], pc[MAXN];
int main () {
scanf("%d%d", &n, &q);
scanf("%s", ss);
for (i=0; i<(1<<n); i++) {
val[i] = ss[i] - '0';
pc[i] = pc[i - (i&-i)]+1;
sum0[i] = val[i];
}
for (int i=0; i<(1<<n); i++) {
sum1[i] = val[i ^ ((1<<n) - 1)];
}
for (i=0; i<n; i++) {
for (j=0; j<(1<<n); j++) {
if (j & (1<<i)) sum0[j] += sum0[j ^ (1<<i)];
if (j & (1<<i)) sum1[j] += sum1[j ^ (1<<i)];
}
}
for (tc=0; tc<q; tc++) {
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |