Submission #774295

# Submission time Handle Problem Language Result Execution time Memory
774295 2023-07-05T13:43:49 Z pashka Mechanical Doll (IOI18_doll) C++14
37 / 100
63 ms 8532 KB
#include "doll.h"
#include <bits/stdc++.h>

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 = (int)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);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 212 KB Output is partially correct
2 Partially correct 47 ms 7508 KB Output is partially correct
3 Partially correct 47 ms 7480 KB Output is partially correct
4 Partially correct 53 ms 8032 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 212 KB Output is partially correct
2 Partially correct 47 ms 7508 KB Output is partially correct
3 Partially correct 47 ms 7480 KB Output is partially correct
4 Partially correct 53 ms 8032 KB Output is partially correct
5 Partially correct 63 ms 8532 KB Output is partially correct
6 Partially correct 57 ms 8260 KB Output is partially correct
7 Partially correct 56 ms 8276 KB Output is partially correct
8 Partially correct 54 ms 8160 KB Output is partially correct
9 Partially correct 53 ms 7508 KB Output is partially correct
10 Partially correct 53 ms 8128 KB Output is partially correct
11 Partially correct 53 ms 8000 KB Output is partially correct
12 Partially correct 47 ms 7484 KB Output is partially correct
13 Partially correct 49 ms 7648 KB Output is partially correct
14 Partially correct 49 ms 7732 KB Output is partially correct
15 Partially correct 48 ms 7740 KB Output is partially correct
16 Partially correct 2 ms 468 KB Output is partially correct
17 Correct 29 ms 4420 KB Output is correct
18 Partially correct 51 ms 7508 KB Output is partially correct
19 Partially correct 48 ms 7508 KB Output is partially correct
20 Partially correct 53 ms 8016 KB Output is partially correct
21 Partially correct 53 ms 8004 KB Output is partially correct
22 Partially correct 52 ms 8040 KB Output is partially correct