#include <iostream>
#include <algorithm>
#define pozitie second
#define numar first
using namespace std;
pair<int,int>v[1000100];
int n,x,s[1000100];
int main(){
cin>>n;
n=(1<<n);
for(int i=1;i<=n;i++){
cin>>v[i].numar;
v[i].pozitie=i;
}
sort(v+1,v+n+1);
for(int i=1;i<=n;i++){
int lim=n;
int sol=0;
while(v[i].numar<v[lim].numar){
sol++;
lim/=2;
}
s[v[i].pozitie]=sol;
}
for(int i=1;i<=n;i++){
cout<<s[i]<<" ";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
372 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Correct |
6 ms |
504 KB |
Output is correct |
5 |
Correct |
39 ms |
980 KB |
Output is correct |
6 |
Correct |
48 ms |
1656 KB |
Output is correct |
7 |
Correct |
97 ms |
2932 KB |
Output is correct |
8 |
Correct |
173 ms |
5168 KB |
Output is correct |
9 |
Correct |
403 ms |
11204 KB |
Output is correct |
10 |
Runtime error |
563 ms |
23124 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |