# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
837746 | becaido | Mechanical Doll (IOI18_doll) | C++17 | 90 ms | 8736 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
void create_circuit(int M, vector<int> A) {
int N, cur = 0;
vector<int> C(M + 1, -1), X, Y;
A.emplace_back(0), N = A.size();
auto rec = [&](auto rec, int sz, int dep)->int {
cur++;
int pos = -cur, i = -(pos + 1);
X.emplace_back(-1), Y.emplace_back(-1);
if (dep == 0) {
if (sz == 1) Y[i] = 0;
if (sz == 2) X[i] = Y[i] = 0;
return pos;
}
int half = 1 << dep;
if (sz <= half) Y[i] = rec(rec, sz, dep - 1);
else {
X[i] = rec(rec, sz - half, dep - 1);
Y[i] = rec(rec, half, dep - 1);
}
return pos;
};
rec(rec, N, __lg(N - 1));
vector<int> b(cur, 0);
int p = 0, pos = -1;
while (p < N) {
int i = -(pos + 1);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |