# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
636414 | berr | Turnir (COCI17_turnir) | C++17 | 605 ms | 42208 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.
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
ios_base::sync_with_stdio(false); cin.tie(0);
int n; cin>>n;
// n-(ondan küçük eleman sayısının logu +1)
vector<int> a(1<<n), b(1<<n), val((1<<n)), ans((1<<n));
for(int i=0; i<a.size(); i++)
{
cin>>a[i];
b[i]=a[i];
}
int l=0, k=2;
for(int i=0; i<(1<<n); i++)
{
if(i+1==k)
{
k*=2;
l++;
}
val[i]=l;
//cout<<val[i]<<" ";
}
sort(b.begin(), b.end());
for(int i=0; i<(1<<n); i++)
{
int pos=upper_bound(b.begin(), b.end(), a[i])-b.begin();
pos--;
ans[i]=n-val[pos];
}
for(auto i: ans) cout<<i<<" ";
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |