Submission #613824

# Submission time Handle Problem Language Result Execution time Memory
613824 2022-07-30T11:39:53 Z fvogel499 Mechanical Doll (IOI18_doll) C++17
37 / 100
126 ms 10956 KB
#include "doll.h"
#include <bits/stdc++.h>

using namespace std;

#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define vi vector<int>

void create_circuit(int nbT, std::vector<int> b) {
    vi tOut(nbT+1, -1);
    int p2 = 1;
    while (p2*2 <= sz(b)) p2 *= 2;
    vi xSw(2*p2-1);
    vi ySw(2*p2-1);
    for (int i = 0; i < p2-1; i++) {
        assert(0 <= i && i < 2*p2-1);
        xSw[i] = -2*(i+1);
        ySw[i] = -2*(i+1)-1;
    }
    for (int i = p2-1; i < 2*p2-1; i++) {
        assert(0 <= i && i < 2*p2-1);
        xSw[i] = ySw[i] = -1;
    }
    ySw[2*p2-2] = 0;
    vi ptr(2*p2-1);
    for (int i = 0; i < p2/2; i++) ptr[i] = 0;
    for (int i : b) {
        int x = 0;
        while (x < p2-1) {
            assert(0 <= i && i < 2*p2-1);
            ptr[x] ^= 1;
            if (ptr[x] == 1) {
                x = -xSw[x]-1;
            }
            else {
                x = -ySw[x]-1;
            }
        }
        assert(0 <= x && x < 2*p2-1);
        if (ptr[x] == 0) {
            assert(xSw[x] == -1);
            xSw[x] = i;
        }
        else {
            assert(ySw[x] == -1);
            ySw[x] = i;
        }
        ptr[x] ^= 1;
    }
    answer(tOut, xSw, ySw);
}
# 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 296 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 212 KB Output is partially correct
2 Partially correct 81 ms 9376 KB Output is partially correct
3 Partially correct 81 ms 9420 KB Output is partially correct
4 Partially correct 119 ms 10504 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 212 KB Output is partially correct
2 Partially correct 81 ms 9376 KB Output is partially correct
3 Partially correct 81 ms 9420 KB Output is partially correct
4 Partially correct 119 ms 10504 KB Output is partially correct
5 Partially correct 113 ms 10956 KB Output is partially correct
6 Partially correct 126 ms 10724 KB Output is partially correct
7 Partially correct 106 ms 10744 KB Output is partially correct
8 Partially correct 118 ms 10548 KB Output is partially correct
9 Partially correct 79 ms 9548 KB Output is partially correct
10 Partially correct 104 ms 10540 KB Output is partially correct
11 Partially correct 101 ms 10440 KB Output is partially correct
12 Partially correct 87 ms 9376 KB Output is partially correct
13 Partially correct 80 ms 9628 KB Output is partially correct
14 Partially correct 86 ms 9636 KB Output is partially correct
15 Partially correct 82 ms 9672 KB Output is partially correct
16 Partially correct 3 ms 596 KB Output is partially correct
17 Correct 56 ms 5788 KB Output is correct
18 Partially correct 85 ms 9448 KB Output is partially correct
19 Partially correct 80 ms 9384 KB Output is partially correct
20 Partially correct 103 ms 10528 KB Output is partially correct
21 Partially correct 103 ms 10520 KB Output is partially correct
22 Partially correct 113 ms 10508 KB Output is partially correct