답안 #970397

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
970397 2024-04-26T13:25:30 Z jamesbamber 자동 인형 (IOI18_doll) C++17
37 / 100
142 ms 13136 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;

void create_circuit(int M, vector<int> A) {
    int N = A.size();
    vector<int> C(M + 1);

    int sz = 1;
    while(sz <= N) sz*= 2;

    vector<int> state(sz+1);
    vector<int> id(2*sz+2);

    function<void(int,int)> addid = [&](int v, int i){
        if(v >= sz){
            id[v] = i;
            return;
        }
        else id[v] = -v;

        addid(2*v + state[v], i);
        state[v] ^= 1;
    };

    for(int i=0; i<N; i++) addid(1, A[i]);
    for(int i=N; i<sz-1; i++) addid(1, -1);
    addid(1, 0);

    //assert(accumulate(state.begin(), state.end(), 0) == 0);

    vector<int> X(sz), Y(sz);
    for(int &x: C) x = -1;
    for(int i=1; i<=sz; i++){
        X[i-1] = id[2*i];
        Y[i-1] = id[2*i+1];
    }

    // for(int x: C) cout << x << " "; cout << endl;
    // for(int x: X) cout << x << " "; cout << endl;
    // for(int x: Y) cout << x << " "; cout << endl;


    answer(C, X, Y);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 348 KB Output is partially correct
2 Partially correct 115 ms 11616 KB Output is partially correct
3 Partially correct 116 ms 11612 KB Output is partially correct
4 Partially correct 122 ms 12684 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 348 KB Output is partially correct
2 Partially correct 115 ms 11616 KB Output is partially correct
3 Partially correct 116 ms 11612 KB Output is partially correct
4 Partially correct 122 ms 12684 KB Output is partially correct
5 Partially correct 127 ms 13136 KB Output is partially correct
6 Partially correct 128 ms 12772 KB Output is partially correct
7 Partially correct 124 ms 13052 KB Output is partially correct
8 Partially correct 142 ms 12628 KB Output is partially correct
9 Partially correct 115 ms 11592 KB Output is partially correct
10 Partially correct 136 ms 12708 KB Output is partially correct
11 Partially correct 122 ms 12628 KB Output is partially correct
12 Partially correct 115 ms 11620 KB Output is partially correct
13 Partially correct 125 ms 11676 KB Output is partially correct
14 Partially correct 124 ms 11692 KB Output is partially correct
15 Partially correct 126 ms 11716 KB Output is partially correct
16 Partially correct 3 ms 600 KB Output is partially correct
17 Correct 63 ms 7000 KB Output is correct
18 Partially correct 117 ms 11604 KB Output is partially correct
19 Partially correct 116 ms 11600 KB Output is partially correct
20 Partially correct 130 ms 12704 KB Output is partially correct
21 Partially correct 124 ms 12680 KB Output is partially correct
22 Partially correct 121 ms 12624 KB Output is partially correct