# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
87040 | 7Polygonz | Turnir (COCI17_turnir) | C++11 | 638 ms | 23900 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.
using namespace std ;
#include <bits/stdc++.h> /* #7th-Polygon */
const int N = 1 << 20 ;
int n , a[N] , b[N] ;
int GetBit(int mask)
{
for (int i = n ; i >= 0 ; --i)
if (mask & (1 << i))
return n - i ;
return n ;
}
int main()
{
ios::sync_with_stdio(false) ;
cout.tie(nullptr) ;
cin.tie(nullptr) ;
cin >> n ;
for (int i = 0 ; i < (1 << n) ; ++i)
cin >> a[i] ;
memcpy(b , a , sizeof(b)) ;
sort(b , b + (1 << n)) ;
for (int i = 0 ; i < (1 << n) ; ++i)
cout << GetBit(upper_bound(b , b + (1 << n) , a[i]) - b) << " " ;
return 0 ;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |