Submission #823597

# Submission time Handle Problem Language Result Execution time Memory
823597 2023-08-12T20:11:06 Z someone Mechanical Doll (IOI18_doll) C++14
47.9459 / 100
101 ms 10512 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;

const int INF = 1e9 + 42;

int id = 0, n;
vector<int> nxt[2], state;

int tree(int lvl, int deb) {
    if(deb >= n) return -INF;
    if(lvl == 0) return 0;
    lvl--;
    int mid = deb + (1 << (lvl));
    int right = tree(lvl, deb), left = tree(lvl, mid);
    nxt[0].push_back(left);
    nxt[1].push_back(right);
    return --id;
}

void create_circuit(int M, vector<int> A) {
    A.push_back(0);
    n = (int)A.size();
    vector<int> C(M + 1);
    tree(18, 0);
    int sz = (int)nxt[0].size();
    for (int i = 0; i <= M; ++i)
        C[i] = -sz;
    for(int i = 0; i < sz; i++) {
        if(nxt[0][i] == -INF)
            nxt[0][i] = -sz;
        if(nxt[1][i] == -INF)
            nxt[1][i] = -sz;
    }
    state.resize((int)nxt[0].size());
    id = 0;
    int i = sz-1;
    while(i != -1) {
        int nex = -nxt[state[i]][i]-1;
        if(nxt[state[i]][i] == 0) {
            nxt[state[i]][i] = A[id++];
            nex = sz-1;
            if(nxt[state[i]][i] == 0) nex = -1;
        }
        state[i] = 1 - state[i];
        i = nex;
    }
    answer(C, nxt[0], nxt[1]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 4 ms 296 KB Output is partially correct
2 Correct 62 ms 6052 KB Output is correct
3 Correct 65 ms 6124 KB Output is correct
4 Correct 99 ms 8928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 4 ms 296 KB Output is partially correct
2 Correct 62 ms 6052 KB Output is correct
3 Correct 65 ms 6124 KB Output is correct
4 Correct 99 ms 8928 KB Output is correct
5 Correct 101 ms 10512 KB Output is correct
6 Correct 98 ms 10020 KB Output is correct
7 Correct 100 ms 10148 KB Output is correct
8 Correct 97 ms 9700 KB Output is correct
9 Correct 61 ms 6084 KB Output is correct
10 Correct 98 ms 9688 KB Output is correct
11 Correct 97 ms 9288 KB Output is correct
12 Correct 63 ms 6256 KB Output is correct
13 Correct 68 ms 6780 KB Output is correct
14 Correct 67 ms 6916 KB Output is correct
15 Correct 67 ms 7048 KB Output is correct
16 Partially correct 6 ms 472 KB Output is partially correct
17 Correct 58 ms 6684 KB Output is correct
18 Correct 64 ms 6256 KB Output is correct
19 Correct 67 ms 6348 KB Output is correct
20 Correct 96 ms 9552 KB Output is correct
21 Correct 98 ms 9276 KB Output is correct
22 Correct 93 ms 9360 KB Output is correct