# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
884414 | ElenaBM | Turnir (COCI17_turnir) | C++17 | 777 ms | 14780 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>
using namespace std;
int main()
{
int n;
cin>> n;
int pot = pow(2, n);
vector<pair<int,int>>num(pot);
for(int i = 0; i < pot; ++i){
cin>> num[i].first;
num[i].second = i;
}
sort(num.begin(), num.end());
vector<int>ans(pot);
for (int i = 0; i < pot; ++i){
int lev = n, k = 1;
bool cont = true;
while(cont){
int x = pow(2, k) -1;
if(num[x].first > num[i].first){
ans[num[i].second] = lev;
cont = 0;
break;
}
else{
lev--;
k++;
if (lev == 0){
ans[num[i].second] = lev;
cont = 0;
}
}
}
}
for (int i = 0; i < pot; ++i)cout<< ans[i] << ' ';
cout<< '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |