# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
94993 | 2019-01-26T14:49:27 Z | Mohammad_Yasser | Mechanical Doll (IOI18_doll) | C++14 | 68 ms | 8524 KB |
#include "doll.h" #include <bits/stdc++.h> using namespace std; struct Graph { int S = 1; int N = 2e5; vector<int> X, Y, turn; void build(int node, int level, int first_turn) { if ((1 << level) > N) { turn[node] = first_turn; return; } X[node] = 2 * node; Y[node] = 2 * node + 1; build(X[node], level + 1, first_turn); build(Y[node], level + 1, first_turn + (1 << level)); X[node] *= -1; Y[node] *= -1; } void build() { while (S < N) { S <<= 1; } X.resize(S); Y.resize(S); turn = vector<int>(2 * S, -1); build(1, 0, 0); } }; void create_circuit(int M, std::vector<int> A) { Graph graph; graph.build(); vector<int> C(M + 1); for (int& x : C) { x = -1; } for (int i = graph.S / 2; i < graph.S; ++i) { if (graph.turn[-graph.X[i]] < A.size()) { graph.X[i] = A[graph.turn[-graph.X[i]]]; } else { graph.X[i] = -1; } if (graph.turn[-graph.Y[i]] < A.size()) { graph.Y[i] = A[graph.turn[-graph.Y[i]]]; } else { graph.Y[i] = -1; } } graph.Y[graph.S - 1] = 0; graph.X.erase(graph.X.begin()); graph.Y.erase(graph.Y.begin()); answer(C, graph.X, graph.Y); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 64 ms | 8524 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 64 ms | 8524 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 64 ms | 8524 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 68 ms | 8512 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 62 ms | 8524 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 62 ms | 8524 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |