#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;
}
# |
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 |
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 |