Submission #884414

#TimeUsernameProblemLanguageResultExecution timeMemory
884414ElenaBMTurnir (COCI17_turnir)C++17
100 / 100
777 ms14780 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>> n; int pot = pow(2, n); vector<pair<int,int>>num(pot); for(int i = 0; i < pot; ++i){ cin>> num[i].first; num[i].second = i; } sort(num.begin(), num.end()); vector<int>ans(pot); for (int i = 0; i < pot; ++i){ int lev = n, k = 1; bool cont = true; while(cont){ int x = pow(2, k) -1; if(num[x].first > num[i].first){ ans[num[i].second] = lev; cont = 0; break; } else{ lev--; k++; if (lev == 0){ ans[num[i].second] = lev; cont = 0; } } } } for (int i = 0; i < pot; ++i)cout<< ans[i] << ' '; cout<< '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...