Submission #884398

#TimeUsernameProblemLanguageResultExecution timeMemory
884398gutzzyTurnir (COCI17_turnir)C++14
100 / 100
405 ms21584 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<pair<int,int>> nums(pow(2,n)); for(int i=0;i<pow(2,n);i++){ int val; cin >> val; nums[i] = {val,i}; } sort(nums.begin(),nums.end()); vector<int> ans(pow(2,n)); int iguals = 0; for(int i=pow(2,n);i>=0;i--){ if(i!=pow(2,n)-1 and nums[i+1].first==nums[i].first){ int pos = nums[i].second; ans[pos] = ans[nums[i+1].second]; } else{ int num = nums[i].first; int pos = nums[i].second; ans[pos] = n - floor(log2(i+1)); } } for(auto a:ans) cout << a << " "; cout << endl; return 0; }

Compilation message (stderr)

turnir.cpp: In function 'int main()':
turnir.cpp:24:17: warning: unused variable 'num' [-Wunused-variable]
   24 |             int num = nums[i].first;
      |                 ^~~
turnir.cpp:17:9: warning: unused variable 'iguals' [-Wunused-variable]
   17 |     int iguals = 0;
      |         ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...