# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
23098 | 2017-05-03T05:23:09 Z | model_code | Turnir (COCI17_turnir) | C++11 | 689 ms | 11500 KB |
#include <cstdio> #include <string> #include <vector> #include <map> #include <cstdlib> #include <algorithm> #include <cstring> using namespace std; typedef long long llint; typedef pair <int, int> pii; const int MAXN = 20; int n; int a[1 << MAXN]; int calc (int x) { if (x == 0) return 0; for (int i = n-1; i >= 0; --i) { if ((1 << i) < x) x -= (1 << i); else return n - i; } return n; } int main (void){ scanf("%d", &n); vector <int> V; for (int i = 0; i < (1 << n); ++i) { scanf("%d", &a[i]); V.push_back(a[i]); } sort(V.begin(), V.end()); for (int i = 0; i < (1 << n); ++i) { printf("%d ", calc(V.end() - upper_bound(V.begin(), V.end(), a[i]))); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 5272 KB | Output is correct |
2 | Correct | 0 ms | 5272 KB | Output is correct |
3 | Correct | 0 ms | 5272 KB | Output is correct |
4 | Correct | 0 ms | 5412 KB | Output is correct |
5 | Correct | 13 ms | 5544 KB | Output is correct |
6 | Correct | 33 ms | 5740 KB | Output is correct |
7 | Correct | 73 ms | 6124 KB | Output is correct |
8 | Correct | 129 ms | 6892 KB | Output is correct |
9 | Correct | 319 ms | 8428 KB | Output is correct |
10 | Correct | 689 ms | 11500 KB | Output is correct |