Submission #147731

# Submission time Handle Problem Language Result Execution time Memory
147731 2019-08-30T13:48:39 Z nicolaalexandra Turnir (COCI17_turnir) C++14
100 / 100
815 ms 25792 KB
#include <iostream>
#include <algorithm>
#define DIM 2000000
using namespace std;

pair <int,int> v[DIM];
int sol[DIM],p[DIM];
int n,i,maxi,m,j;
int main (){

    cin>>n;
    m = n, n = (1<<n);
    for (i=1;i<=n;i++){
        cin>>v[i].first;
        v[i].second = i;
    }
    for (i=2;i<=n;i++)
        p[i] = p[i/2]+1;
    sort (v+1,v+n+1);
    j = 1;
    for (i=1;i<=n;i++){
        while (j < n && v[j+1].first <= v[i].first)
            j++;

        sol[v[i].second] = m-p[j];
    }
    for (i=1;i<=n;i++)
        cout<<sol[i]<<" ";

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 7 ms 504 KB Output is correct
5 Correct 23 ms 1016 KB Output is correct
6 Correct 47 ms 1784 KB Output is correct
7 Correct 94 ms 3320 KB Output is correct
8 Correct 174 ms 6264 KB Output is correct
9 Correct 406 ms 13188 KB Output is correct
10 Correct 815 ms 25792 KB Output is correct