이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define maxN 1100005
using namespace std;
long long n,m,i,a[maxN],res;
unsigned long long x,b[maxN],s;
map <unsigned long long,int> p[4];
int main() {
std::ios_base::sync_with_stdio(false);
srand(time(NULL));
cin>>m;
if(m==1) {cout<<2<<endl; return 0;}
n=pow(2,m);
for(i=0;i<n;i++){
cin>>a[i];
x=rand();
x=(x<<32) | rand();
b[a[i]]=b[n-1-a[i]]=x;
}
s=0;
for(i=0;i<=n;i++){
res += p[i%4][s]++;
s=s xor b[a[i]];
}
cout<<(n*(n+1))/2-res<<endl;
return 0;
}
# | 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... |