# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
884411 | Ariadna | Turnir (COCI17_turnir) | C++14 | 908 ms | 31444 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 log_2(int n) {
int p = 0;
while (n > 1) {
n /= 2;
++p;
}
return p;
}
int main()
{
int n;
cin >> n;
vector < int > a(1 << n);
vector < int > b(1 << n);
for (int i = 0; i < (1 << n); ++i) {
cin >> a[i];
b[i] = a[i];
}
map < int, int > m;
sort(a.begin(), a.end());
for (int i = 0; i + 1 < (1 << n); ++i) {
if (a[i + 1] > a[i]) {
m[a[i]] = int(log_2(i + 1));
}
}
m[a[(1 << n) - 1]] = n;
for (int i : b) {
cout << n - m[i] << " ";
}
cout << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |