# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
170583 | 2019-12-25T17:28:20 Z | mdn2002 | Turnir (COCI17_turnir) | C++14 | 353 ms | 12664 KB |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1000010; int n, k; int ar[MAXN]; int sar[MAXN]; int main() { scanf("%d", &k); n = 1 << k; for (int i = 0; i < n; i++) { scanf("%d", &ar[i]); sar[i] = ar[i]; } sort(sar, sar + n); sar[n] = INT_MAX; for (int i = 0; i < n; i++) { int x = ar[i]; int lo = 0, hi = n; while (lo < hi) { int mid = lo + (hi - lo) / 2; if (sar[mid] > x) { hi = mid; } else { lo = mid + 1; } } int cur = lo - 1; int ans = k; while (cur) { cur--; ans--; cur /= 2; } if (i) printf(" "); printf("%d", ans); } puts(""); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 18 ms | 888 KB | Output is correct |
6 | Correct | 36 ms | 1400 KB | Output is correct |
7 | Correct | 78 ms | 2424 KB | Output is correct |
8 | Correct | 157 ms | 4428 KB | Output is correct |
9 | Correct | 353 ms | 7288 KB | Output is correct |
10 | Incorrect | 352 ms | 12664 KB | Output isn't correct |