#include <bits/stdc++.h>
using namespace std;
int a[2000000],b[2000000],d[2000000];
int main()
{ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;cin>>n;
int nn=n;
n=(1<<n);
for(int i=0;i<n;i++)
{
cin>>a[i];
b[a[i]]++;
}
for(int i=1;i<1000090;i++)
{
b[i]+=b[i-1];
}
for(int i=0;i<n;i++)
{
d[i]=b[a[i]]-1;
}
int re=0;
for(int i=0;i<n;i++)
{
re=0;
int sum=1;
for(int j=1 ;j<21;j++)
{
if ((sum)<=d[i]){
re++;
sum+=(1<<j);
};
}
cout<<nn-re<<" ";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
4472 KB |
Output is correct |
2 |
Correct |
6 ms |
4216 KB |
Output is correct |
3 |
Correct |
6 ms |
4344 KB |
Output is correct |
4 |
Correct |
8 ms |
4348 KB |
Output is correct |
5 |
Correct |
12 ms |
4728 KB |
Output is correct |
6 |
Correct |
19 ms |
5240 KB |
Output is correct |
7 |
Correct |
29 ms |
6264 KB |
Output is correct |
8 |
Correct |
51 ms |
8152 KB |
Output is correct |
9 |
Correct |
114 ms |
12920 KB |
Output is correct |
10 |
Correct |
230 ms |
21624 KB |
Output is correct |