Submission #147821

#TimeUsernameProblemLanguageResultExecution timeMemory
147821mariadincaTurnir (COCI17_turnir)C++14
100 / 100
819 ms21716 KiB
#include <iostream> #include <algorithm> using namespace std; int n, m, i, dr, nivel, sol[2000001]; pair<int, int> v[2000002]; int main(){ cin>>m; n = (1<<m); for(i=1;i<=n;i++){ cin>>v[i].first; v[i].second = i; } sort(v+1, v+n+1); for(i=1;i<=n;i++){ nivel = 0; dr = n; while(v[i].first < v[dr].first) dr /= 2, nivel++; sol[v[i].second] = nivel; } for(i=1;i<=n;i++) cout<<sol[i]<<" "; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...