Submission #856100

#TimeUsernameProblemLanguageResultExecution timeMemory
856100vjudge1Turnir (COCI17_turnir)C++17
100 / 100
469 ms19140 KiB
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast,O3,unroll-loops") #define int long long #define vi vector<int> #define vvi vector<vi> #define pii pair<int, int> #define vpi vector<pii> #define vvpi vector<vpi> #define vb vector<bool> #define vvb vector<vb> #define endl "\n" #define sp << " " << #define F(i, s, n) for(int i = s; i < n; i++) #define pb push_back #define fi first #define se second int mod = 998244353; int inf = LLONG_MAX >> 3; int mult(int x, int y) { return (x%mod)*(y%mod)%mod; } void solve() { int n; cin >> n; int m = 1ll << n; vi a, b; F(i, 0, m) { int x; cin >> x; a.pb(x); b.pb(x); } sort(b.begin(), b.end()); F(i, 0, m) { int l = upper_bound(b.begin(), b.end(), a[i]) - b.begin(); l = __lg(l); l = n - l; cout << l << " "; } cout << endl; } void setIO() { ios::sync_with_stdio(0); cin.tie(0); #ifdef Local freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif } signed main() { setIO(); int t = 1; //cin >> t; while(t--) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...