# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
884411 | Ariadna | Turnir (COCI17_turnir) | C++14 | 908 ms | 31444 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |