# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
147594 | SeekingOblivion | Turnir (COCI17_turnir) | C++14 | 820 ms | 18936 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<fstream>
#include<algorithm>
#include<iostream>
#define fin cin
#define fout cout
using namespace std;
//ifstream fin("date.in");
//ofstream fout("date.out");
int i,n,sol[(1<<20)+10],r[(1<<20)+10],p,ok;
pair<int,int> v[(1<<20)+10];
int main()
{
fin>>n;
for(i=1;i<=(1<<n);i++){
fin>>v[i].first;
v[i].second=i;
}
sort(v+1,v+(1<<n)+1);p=1;ok=0;
for(i=1;i<=(1<<n);i++)
{
if(p*2==i) ok++,p*=2;
r[i]=n-ok;
}
for(i=(1<<n);i>=1;i--)
{
if(v[i].first==v[i+1].first) r[i]=r[i+1];
sol[v[i].second]=r[i];
}
for(i=1;i<=(1<<n);i++) fout<<sol[i]<<" ";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |