# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
97329 | E869120 | Mechanical Doll (IOI18_doll) | C++14 | 156 ms | 14100 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 "doll.h"
#include <bits/stdc++.h>
using namespace std;
struct Node {
int ty, l, r;
};
int N, cnts = 2; Node G[500009];
void create_circuit(int M, std::vector<int> A) {
N = A.size(); N++;
int dep = 0; for (int i = 0; i < 22; i++) { int Z = (1 << i); if (Z >= N) { dep = i; break; } }
for (int i = 0; i < 500009; i++) G[i] = Node{0, -1, -1};
vector<int>T; T.push_back(1);
for (int i = dep - 1; i >= 1; i--) {
int A = (N + (1 << i) - 1) / (1 << i); vector<int> TT;
int AL = 0, AR = A - 1; if (A % 2 == 1) { AL++; AR++; }
for (int j = AL; j <= AR; j++) {
if (j % 2 == 0) {
G[T[j / 2]].l = cnts; TT.push_back(cnts); cnts++;
}
else {
G[T[j / 2]].r = cnts; TT.push_back(cnts); cnts++;
}
}
T = TT;
}
Compilation message (stderr)
# | 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... |