# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
371018 | FatihSolak | Turnir (COCI17_turnir) | C++17 | 2 ms | 512 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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]] << " ";
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |