답안 #147821

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
147821 2019-08-30T19:42:03 Z mariadinca Turnir (COCI17_turnir) C++14
100 / 100
819 ms 21716 KB
#include <iostream>
#include <algorithm>

using namespace std;

int n, m, i, dr, nivel, sol[2000001];
pair<int, int> v[2000002];

int main(){
    cin>>m;
    n = (1<<m);
    for(i=1;i<=n;i++){
        cin>>v[i].first;
        v[i].second = i;
    }
    sort(v+1, v+n+1);
    for(i=1;i<=n;i++){
        nivel = 0;
        dr = n;
        while(v[i].first < v[dr].first)
            dr /= 2, nivel++;
        sol[v[i].second] = nivel;
    }
    for(i=1;i<=n;i++)
        cout<<sol[i]<<" ";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 6 ms 540 KB Output is correct
5 Correct 23 ms 940 KB Output is correct
6 Correct 47 ms 1656 KB Output is correct
7 Correct 93 ms 2808 KB Output is correct
8 Correct 180 ms 5224 KB Output is correct
9 Correct 402 ms 11144 KB Output is correct
10 Correct 819 ms 21716 KB Output is correct