Submission #147594

#TimeUsernameProblemLanguageResultExecution timeMemory
147594SeekingOblivionTurnir (COCI17_turnir)C++14
100 / 100
820 ms18936 KiB
//#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 timeMemoryGrader output
Fetching results...