Submission #371019

#TimeUsernameProblemLanguageResultExecution timeMemory
371019FatihSolakTurnir (COCI17_turnir)C++17
100 / 100
1345 ms38508 KiB
#include <bits/stdc++.h> #define N 20 using namespace std; int arr[1<<N]; int brr[1<<N]; map<int,int> mp; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); int n; cin >> n; for(int i = 0;i<(1<<n);i++){ cin >> arr[i]; brr[i] = arr[i]; } sort(brr,brr+(1<<n)); int cnt = 0; int num = 0; int pw = 1; for(int i=0;i<(1<<n);i++){ if((i-cnt) == pw){ cnt += pw; pw = pw*2; num++; } mp[brr[i]] = n-num; } for(int i=0;i<(1<<n);i++){ cout << mp[arr[i]] << " "; } }
#Verdict Execution timeMemoryGrader output
Fetching results...