Submission #884411

#TimeUsernameProblemLanguageResultExecution timeMemory
884411AriadnaTurnir (COCI17_turnir)C++14
100 / 100
908 ms31444 KiB
#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 timeMemoryGrader output
Fetching results...