Submission #170580

#TimeUsernameProblemLanguageResultExecution timeMemory
170580mdn2002Turnir (COCI17_turnir)C++14
100 / 100
1591 ms38520 KiB
#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 timeMemoryGrader output
Fetching results...