# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
884398 | gutzzy | Turnir (COCI17_turnir) | C++14 | 405 ms | 21584 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |