# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
92376 | Alexa2001 | Snake Escaping (JOI18_snake_escaping) | C++17 | 1048 ms | 47284 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 <bits/stdc++.h>
using namespace std;
const int Nmax = (1<<20);
int n, q;
char S[Nmax+2], Val[Nmax+2];
int val[Nmax], up[Nmax], down[Nmax], bits[Nmax];
void precalc()
{
int i, j;
for(i=0; i<(1<<n); ++i)
bits[i] = __builtin_popcount(i), up[i] = down[i] = val[i] = Val[i] - '0';
for(i=0; i<n; ++i)
for(j=0; j<(1<<n); ++j)
if(j & (1<<i))
up[j ^ (1<<i)] += up[j];
else down[j ^ (1<<i)] += down[j];
}
int solveQ(int mask, int que)
{
int i, j, ans = 0;
for(i=que, j = 0; j < (1<<bits[que]); i = (i-1) & que, ++j)
ans += val[i ^ mask];
return ans;
}
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... |