# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
147581 | KCSC | Turnir (COCI17_turnir) | C++14 | 819 ms | 25900 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;
const int DIM = (1 << 20) + 5;
int pwr[DIM], sol[DIM];
pair<int, int> arr[DIM];
int main(void) {
int n;
cin >> n;
n = (1 << n);
for (int i = 1; i <= n; ++i) {
cin >> arr[i].first;
arr[i].second = i;
}
sort(arr + 1, arr + n + 1);
for (int i = 2; i <= n; ++i)
pwr[i] = pwr[i >> 1] + 1;
for (int i = 1, j = 1; i <= n; ++i) {
while (j + 1 <= n && arr[j + 1].first <= arr[i].first)
++j;
sol[arr[i].second] = pwr[n] - pwr[j];
}
for (int i = 1; i <= n; ++i)
cout << sol[i] << " ";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |