| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 66515 | KLPP | Turnir (COCI17_turnir) | C++14 | 666 ms | 28152 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... | ||||
