Submission #815747

# Submission time Handle Problem Language Result Execution time Memory
815747 2023-08-08T20:49:28 Z rnl42 Mechanical Doll (IOI18_doll) C++14
47 / 100
81 ms 11208 KB
#include "doll.h"
using namespace std;

int M, N;
vector<int> A;
vector<int> C, X, Y;
vector<bool> state;

void push(int* pos, int val) {
  while (*pos < 0) {
    state[-*pos-1].flip();
    pos = !state[-*pos-1] ? &X[-*pos-1] : &Y[-*pos-1];
  }
  int prev = *pos;
  *pos = -1-(int)X.size();
  state.push_back(true);
  X.push_back(prev);
  Y.push_back(val);
}

void create_circuit(int __M, vector<int> __A) {
  M = __M;
  A = __A;
  N = A.size();
  C.resize(M+1);
  X.reserve(3*N);
  Y.reserve(3*N);
  C[0] = A[0];
  C[A[0]] = A[1];
  for (int i = 2; i < N; i++) {
    push(&C[A[0]], A[i]);
  }
  for (int i = 1; i <= M; i++) {
    C[i] = -1;
  }
  int missing = (1<<__lg(2*N-1))-N;
  if (missing > 0) {
    for (int i = 0; i < missing; i++) {
      push(&C[1], -1);
    }
  }
  push(&C[A[0]], 0);

  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 Correct 1 ms 288 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 288 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 212 KB Output is partially correct
2 Correct 37 ms 5772 KB Output is correct
3 Partially correct 62 ms 9008 KB Output is partially correct
4 Partially correct 76 ms 10272 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 212 KB Output is partially correct
2 Correct 37 ms 5772 KB Output is correct
3 Partially correct 62 ms 9008 KB Output is partially correct
4 Partially correct 76 ms 10272 KB Output is partially correct
5 Partially correct 81 ms 11208 KB Output is partially correct
6 Partially correct 81 ms 11020 KB Output is partially correct
7 Partially correct 74 ms 11148 KB Output is partially correct
8 Partially correct 75 ms 10880 KB Output is partially correct
9 Partially correct 62 ms 9040 KB Output is partially correct
10 Partially correct 70 ms 10676 KB Output is partially correct
11 Partially correct 68 ms 10380 KB Output is partially correct
12 Partially correct 64 ms 9240 KB Output is partially correct
13 Correct 37 ms 6184 KB Output is correct
14 Partially correct 67 ms 9812 KB Output is partially correct
15 Partially correct 70 ms 9924 KB Output is partially correct
16 Partially correct 2 ms 596 KB Output is partially correct
17 Correct 36 ms 5876 KB Output is correct
18 Correct 36 ms 5776 KB Output is correct
19 Partially correct 70 ms 9280 KB Output is partially correct
20 Partially correct 71 ms 10560 KB Output is partially correct
21 Partially correct 71 ms 10396 KB Output is partially correct
22 Partially correct 69 ms 10436 KB Output is partially correct