# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
167999 | 2019-12-11T06:49:13 Z | rzbt | Dojave (COCI17_dojave) | C++14 | 1722 ms | 97756 KB |
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define F first #define S second #define all(x) x.begin(),x.end() #define MAXN 2000000 typedef long long ll; using namespace std; ll niz[MAXN]; ll m,n; ll nu,ve; ll bit[MAXN],dubina[MAXN]; ll nula=1,tksor,td; ll gde[MAXN]; ll r1,r2; map<ll,ll> mpa; void dodaj(ll p,ll x){ for(;p<MAXN;p+=(-p)&p) bit[p]+=x; } ll dobij(ll p){ ll z=0; for(;p>0;p-=(-p)&p) z+=bit[p]; return z; } ll res; int main() { srand(time(NULL)); scanf("%lld", &m); if(m==1){ printf("2"); return 0; } n=1<<m; res=n*(n+1)/2; for(ll i=1;i<=n;i++){ scanf("%lld",niz+i); } for(ll i=1;i<=n;i++){ gde[niz[i]]=i; if(!gde[n-niz[i]-1]){ r1=rand(); r2=rand(); bit[i]=r1 ^(r2<<16ll); }else bit[i]=(1ll<<34ll)-1-bit[gde[n-niz[i]-1]]; auto a=mpa.insert(mp(tksor,1)); if(!a.S)a.F->S++; tksor^=bit[i]; res-=mpa[tksor]; //printf(" %lld %lld %lld\n",i,td,n-niz[i]-1); } printf("%lld",res); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 632 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 888 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 12 ms | 1784 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 52 ms | 6396 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 50 ms | 6428 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 307 ms | 24584 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1722 ms | 97756 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1679 ms | 97700 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |