Submission #170580

# Submission time Handle Problem Language Result Execution time Memory
170580 2019-12-25T17:25:59 Z mdn2002 Turnir (COCI17_turnir) C++14
100 / 100
1591 ms 38520 KB
#include<bits/stdc++.h>
using namespace std;
const long long mod=998244353;
int n,x,a[(1<<20)+3],b[(1<<20)+3];
map<int,int>m;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("lemonade.in","r",stdin);
    //freopen("lemonade.out","w",stdout);
    cin>>n;
    x=1<<n;
    for(int i=0;i<x;i++)
    {
        cin>>a[i];
        b[i]=a[i];
    }
    sort(a,a+x);
    for(int i=0;i<x;i++)
    {
        int num=upper_bound(a,a+x,a[i])-a,ans=n+1;
        while(num)
        {
            num/=2;
            ans--;
        }
        m[a[i]]=ans;
    }
    for(int i=0;i<x;i++)cout<<m[b[i]]<<' ';
}
# 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 4 ms 504 KB Output is correct
5 Correct 21 ms 1272 KB Output is correct
6 Correct 59 ms 3320 KB Output is correct
7 Correct 121 ms 4984 KB Output is correct
8 Correct 138 ms 4664 KB Output is correct
9 Correct 711 ms 24300 KB Output is correct
10 Correct 1591 ms 38520 KB Output is correct