# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
66515 | KLPP | Turnir (COCI17_turnir) | C++14 | 666 ms | 28152 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<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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |