Submission #856145

#TimeUsernameProblemLanguageResultExecution timeMemory
856145vjudge1Turnir (COCI17_turnir)C++17
30 / 100
519 ms18736 KiB
#include <bits/stdc++.h> using namespace std; #define sp << " " << #define int long long #define vi vector<int> #define pb push_back #define F(xxx,yyy) for (int xxx=1;xxx<=yyy;xxx++) #define pii pair<int,int> #define all(x) x.begin()+1,x.end() void solve() { int n; cin >> n; int N = n; n = 1; F(i,N) n*=2; vi a(n+1); F(i,n) cin >> a[i]; vi b(n+1); F(i,n) b[i] = a[i]; sort(b.begin()+1,b.end()); for (int i=1;i<=n;i++) { int r = upper_bound(b.begin()+1,b.end(),a[i])-b.begin()-1; int ans = N; for (int j=1;j<=N;j++) if (r >= (1<<j)-1) ans = N-j; cout << ans << " "; } cout << endl; } signed main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int t = 1; //cin >> t; while (t --> 0) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...