답안 #856077

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
856077 2023-10-02T16:22:18 Z vjudge1 Turnir (COCI17_turnir) C++17
100 / 100
1680 ms 65536 KB
#ifndef Local
    #pragma GCC optimize("O3,unroll-loops")
    #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#endif
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define lim 1000001
using namespace std;
const int mod=1000000007ll;

map<int,int>a;
map<int,int>ans;

void solve(){
    int n;
    cin>>n;
    int N=1<<n;
    int aa[N];
    for(int i=0;i<N;i++){
        cin>>aa[i];
        a[aa[i]]++;
    }
    int cur=0;
    for(auto [f,s]:a){
        cur+=s;
        ans[f]=__lg(cur);
    }
    for(int i=0;i<N;i++){
        cout<<n-ans[aa[i]]<<" ";
    }
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
#ifdef Local  
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
#endif
    int t=1;
    //cin>>t;
    while (t--)
    {
        solve();
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 2 ms 464 KB Output is correct
5 Correct 13 ms 2004 KB Output is correct
6 Correct 44 ms 6540 KB Output is correct
7 Correct 76 ms 9484 KB Output is correct
8 Correct 90 ms 5460 KB Output is correct
9 Correct 801 ms 49592 KB Output is correct
10 Correct 1680 ms 65536 KB Output is correct