답안 #759077

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
759077 2023-06-15T18:18:59 Z alexander707070 자동 인형 (IOI18_doll) C++14
37 / 100
71 ms 13420 KB
#include<bits/stdc++.h>
#include "doll.h"
#define MAXN 800007
using namespace std;

int m,power,n;
int a[MAXN],s;
int lt[MAXN],rt[MAXN];
vector<int> from,to,c;

int rev(int x){
    int res=0;
    for(int i=1;i<power;i*=2){
        res*=2; res+=x%2; 
        x/=2;
    }
    return res;
}

void build(int v,int l,int r,int num){
    if(l+1==r){
        num*=2;
        if(rev(num)<n)lt[v]=a[rev(num)];
        else if(rev(num)==power-1)lt[v]=0;
        else lt[v]=-1;

        num++;
        if(rev(num)<n)rt[v]=a[rev(num)];
        else if(rev(num)==power-1)rt[v]=0;
        else rt[v]=-1;
    }else{
        int tt=(l+r)/2;
        build(2*v,l,tt,2*num);
        build(2*v+1,tt+1,r,2*num+1);

        lt[v]=-2*v; rt[v]=-2*v-1;
    }
}

void create_circuit(int M, vector<int> A){
    m=M; n=int(A.size());

    for(int i=0;i<n;i++){
        a[i]=A[i];
    }
    
    power=1;
    while(power<n+1)power*=2;
    build(1,0,power-1,0);

    for(int i=0;i<=m;i++)c.push_back(-1);

    for(int i=1;i<=power-1;i++){
        from.push_back(lt[i]);
        to.push_back(rt[i]);
    }
    answer(c,from,to);
}

/*
int main(){
     create_circuit(4, {1, 2, 1,3,2,4,3,1,2});
}
*/



# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 212 KB Output is partially correct
2 Partially correct 57 ms 10348 KB Output is partially correct
3 Partially correct 60 ms 11284 KB Output is partially correct
4 Partially correct 64 ms 12528 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 212 KB Output is partially correct
2 Partially correct 57 ms 10348 KB Output is partially correct
3 Partially correct 60 ms 11284 KB Output is partially correct
4 Partially correct 64 ms 12528 KB Output is partially correct
5 Partially correct 71 ms 13420 KB Output is partially correct
6 Partially correct 71 ms 13084 KB Output is partially correct
7 Partially correct 68 ms 13184 KB Output is partially correct
8 Partially correct 67 ms 12896 KB Output is partially correct
9 Partially correct 56 ms 11280 KB Output is partially correct
10 Partially correct 66 ms 12928 KB Output is partially correct
11 Partially correct 64 ms 12600 KB Output is partially correct
12 Partially correct 58 ms 11464 KB Output is partially correct
13 Partially correct 65 ms 11792 KB Output is partially correct
14 Partially correct 63 ms 11864 KB Output is partially correct
15 Partially correct 63 ms 12040 KB Output is partially correct
16 Partially correct 2 ms 724 KB Output is partially correct
17 Correct 38 ms 6984 KB Output is correct
18 Partially correct 58 ms 11448 KB Output is partially correct
19 Partially correct 59 ms 11440 KB Output is partially correct
20 Partially correct 65 ms 12696 KB Output is partially correct
21 Partially correct 64 ms 12496 KB Output is partially correct
22 Partially correct 65 ms 12556 KB Output is partially correct