Submission #764237

# Submission time Handle Problem Language Result Execution time Memory
764237 2023-06-23T09:17:49 Z t6twotwo Mechanical Doll (IOI18_doll) C++17
47 / 100
75 ms 9396 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> ord(int lg) {
    int N = 1 << lg;
    vector<int> ans(N), s(N);
    int x = 1, t = 0;
    while (1) {
        if (x >= N) {
            ans[x - N] = t++;
            if (x == 2 * N - 1) {
                break;
            }
            x = 1;
        } else {
            if (s[x] == 0) {
                s[x] = 1;
                x = x * 2;
            } else {
                s[x] = 0;
                x = x * 2 + 1;
            }
        }
    }
    return ans;
}
void create_circuit(int M, vector<int> A) {
    int N = A.size();
    int lg = __lg(N - 1) + 1;
    int K = 1 << lg;
    vector<int> C(M + 1, -1), X(K - 1, -1), Y(K - 1, -1);
    C[0] = A[0];
    for (int i = 0; i < (K / 2) - 1; i++) {
        X[i] = ~(2 * i + 1);
        Y[i] = ~(2 * i + 2);
    }
    auto a = ord(lg);
    for (int i = 0; i < K / 2; i++) {
        if (a[i * 2] < N - 1) {
            X[i + K / 2 - 1] = A[a[i * 2] + 1];
        }
        if (a[i * 2 + 1] < N - 1) {
            Y[i + K / 2 - 1] = A[a[i * 2 + 1] + 1];
        }
    }
    Y[K - 2] = 0;
    answer(C, X, Y);
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 212 KB Output is partially correct
2 Correct 38 ms 4916 KB Output is correct
3 Partially correct 69 ms 8552 KB Output is partially correct
4 Partially correct 68 ms 8928 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 212 KB Output is partially correct
2 Correct 38 ms 4916 KB Output is correct
3 Partially correct 69 ms 8552 KB Output is partially correct
4 Partially correct 68 ms 8928 KB Output is partially correct
5 Partially correct 75 ms 9396 KB Output is partially correct
6 Partially correct 72 ms 9268 KB Output is partially correct
7 Partially correct 72 ms 9284 KB Output is partially correct
8 Partially correct 71 ms 9144 KB Output is partially correct
9 Partially correct 64 ms 8392 KB Output is partially correct
10 Partially correct 72 ms 9088 KB Output is partially correct
11 Partially correct 70 ms 8932 KB Output is partially correct
12 Partially correct 63 ms 8396 KB Output is partially correct
13 Correct 38 ms 5072 KB Output is correct
14 Partially correct 66 ms 8728 KB Output is partially correct
15 Partially correct 66 ms 8752 KB Output is partially correct
16 Partially correct 2 ms 596 KB Output is partially correct
17 Correct 39 ms 4944 KB Output is correct
18 Correct 36 ms 4936 KB Output is correct
19 Partially correct 63 ms 8528 KB Output is partially correct
20 Partially correct 70 ms 9076 KB Output is partially correct
21 Partially correct 69 ms 8968 KB Output is partially correct
22 Partially correct 71 ms 9012 KB Output is partially correct