답안 #147594

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
147594 2019-08-30T08:37:02 Z SeekingOblivion Turnir (COCI17_turnir) C++14
100 / 100
820 ms 18936 KB
//#include<fstream>
#include<algorithm>
#include<iostream>
#define fin cin
#define fout cout
using namespace std;
//ifstream fin("date.in");
//ofstream fout("date.out");
int i,n,sol[(1<<20)+10],r[(1<<20)+10],p,ok;
pair<int,int> v[(1<<20)+10];
int main()
{
    fin>>n;
    for(i=1;i<=(1<<n);i++){
        fin>>v[i].first;
        v[i].second=i;
    }
    sort(v+1,v+(1<<n)+1);p=1;ok=0;
    for(i=1;i<=(1<<n);i++)
    {
        if(p*2==i) ok++,p*=2;
        r[i]=n-ok;
    }
    for(i=(1<<n);i>=1;i--)
    {
        if(v[i].first==v[i+1].first) r[i]=r[i+1];
        sol[v[i].second]=r[i];
    }
    for(i=1;i<=(1<<n);i++) fout<<sol[i]<<" ";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 6 ms 504 KB Output is correct
5 Correct 23 ms 888 KB Output is correct
6 Correct 48 ms 1528 KB Output is correct
7 Correct 97 ms 2680 KB Output is correct
8 Correct 179 ms 4980 KB Output is correct
9 Correct 405 ms 9708 KB Output is correct
10 Correct 820 ms 18936 KB Output is correct