Submission #89069

#TimeUsernameProblemLanguageResultExecution timeMemory
89069igziDojave (COCI17_dojave)C++17
84 / 140
1997 ms97176 KiB
#include <bits/stdc++.h> #define maxN 1100005 using namespace std; long long n,m,i,a[maxN],res,cnt=103; unsigned long long x,y,b[maxN],s; map <unsigned long long,int> p[4]; int main() { std::ios_base::sync_with_stdio(false); srand(time(NULL)); x=1414933401; y=1371143745; cin>>m; if(m==1) {cout<<2<<endl; return 0;} n=pow(2,m); for(i=0;i<n;i++){ cin>>a[i]; b[a[i]]=b[n-1-a[i]]=rand()*x+y; cnt++; } s=0; for(i=0;i<=n;i++){ if(p[i%4].find(s)!=p[i%4].end()) res+=p[i%4][s]; if(p[i%4].find(s)==p[i%4].end()){ p[i%4][s]=1; } else p[i%4][s]++; s=s xor b[a[i]]; } cout<<(n*(n+1))/2-res<<endl; return 0; }
#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...
#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...