Submission #66515

#TimeUsernameProblemLanguageResultExecution timeMemory
66515KLPPTurnir (COCI17_turnir)C++14
100 / 100
666 ms28152 KiB
#include<iostream> #include<vector> #include<queue> #include<algorithm> #include<stdio.h> using namespace std; int main(){ int n; cin>>n; int pow=(1<<n);//cout<<pow<<endl; pair<int,int> arr[pow]; for(int i=0;i<pow;i++){ cin>>arr[i].first; arr[i].second=i; } sort(arr,arr+pow); int position=pow; int best[pow]; best[arr[pow-1].second]=0; for(int i=pow-2;i>-1;i--){ //cout<<arr[i].second<<endl; if(arr[i].first<arr[i+1].first){ position=i+1; } for(int j=0;j<=n && position>=(1<<j);j++){ //cout<<j<<endl; best[arr[i].second]=n-j; } //cout<<best[arr[i].second]<<endl; } for(int i=0;i<pow;i++)cout<<best[i]<<" "; cout<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...