답안 #774159

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
774159 2023-07-05T12:27:27 Z pashka 자동 인형 (IOI18_doll) C++14
37 / 100
66 ms 9964 KB
#include "doll.h"
#include<iostream>

using namespace std;

int reverse(int x, int k) {
    int y = 0;
    for (int i = 0;i < k; i++) {
        y = (y * 2) + (x % 2);
        x /= 2;
    }
    return y;
}

void create_circuit(int M, std::vector<int> A) {
    int n = A.size();
    int k = 0;
    while ((1 << (k + 1)) < n + 1) {
        k++;
    }
    vector<int> x((1 << (k + 1)) - 1), y((1 << (k + 1)) - 1);
    for (int i = 0; i < (1 << k) - 1; i++) {
        x[i] = -((2 * i + 1) + 1);
        y[i] = -((2 * i + 2) + 1);
    }
    for (int i = 0; i < (1 << k); i++) {
        int t = reverse(2 * i, k + 1);
        if (t < n) {
            t = A[t];
        } else {
            t = -1;
        }
        x[(1 << k) - 1 + i] = t;
        t = reverse(2 * i + 1, k + 1);
        if (t < n) {
            t = A[t];
        } else if (i == (1 << k) - 1) {
            t = 0;
        } else {
            t = -1;
        }
        y[(1 << k) - 1 + i] = t;
    }
    vector<int> c(M + 1, -1);
//    for (int i = 0; i < x.size(); i++) {
//        cout << x[i] << " " << y[i] << "\n";
//    }
    answer(c, x, y);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 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 47 ms 8364 KB Output is partially correct
3 Partially correct 47 ms 8360 KB Output is partially correct
4 Partially correct 53 ms 9396 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 212 KB Output is partially correct
2 Partially correct 47 ms 8364 KB Output is partially correct
3 Partially correct 47 ms 8360 KB Output is partially correct
4 Partially correct 53 ms 9396 KB Output is partially correct
5 Partially correct 61 ms 9964 KB Output is partially correct
6 Partially correct 56 ms 9704 KB Output is partially correct
7 Partially correct 57 ms 9772 KB Output is partially correct
8 Partially correct 54 ms 9616 KB Output is partially correct
9 Partially correct 48 ms 8404 KB Output is partially correct
10 Partially correct 53 ms 9480 KB Output is partially correct
11 Partially correct 53 ms 9476 KB Output is partially correct
12 Partially correct 48 ms 8360 KB Output is partially correct
13 Partially correct 51 ms 8616 KB Output is partially correct
14 Partially correct 49 ms 8660 KB Output is partially correct
15 Partially correct 49 ms 8748 KB Output is partially correct
16 Partially correct 2 ms 596 KB Output is partially correct
17 Correct 29 ms 5336 KB Output is correct
18 Partially correct 48 ms 8396 KB Output is partially correct
19 Partially correct 48 ms 8364 KB Output is partially correct
20 Partially correct 66 ms 9500 KB Output is partially correct
21 Partially correct 53 ms 9420 KB Output is partially correct
22 Partially correct 54 ms 9428 KB Output is partially correct