# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
36860 | szawinis | Dojave (COCI17_dojave) | C++14 | 4000 ms | 11232 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 N = (1 << 20) + 1;
int m, n, ans, a[N], s[N];
bool mark[N];
int main() {
scanf("%d", &m);
if(m == 1) printf("2"), exit(0);
n = 1 << m;
ans = n*(n+1) / 2;
for(int i = 1; i <= n; i++) {
scanf("%d", a+i);
s[i] = s[i-1] ^ a[i];
}
for(int i = 1; i <= n; i++) {
int cnt = 0;
for(int j = i; j <= n; j++) {
mark[a[j]] = true;
cnt += mark[a[j] ^ (n-1)];
if(s[j] ^ s[i-1] || (j-i+1) % 4) continue;
if(cnt == j-i+1 >> 1) --ans;
}
for(int j = i; j <= n; j++) mark[a[j]] = false;
}
printf("%d", 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... |
# | 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... |