# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
553424 | timreizin | Mechanical Doll (IOI18_doll) | C++17 | 126 ms | 10960 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 <array>
#include <cmath>
using namespace std;
void create_circuit(int m, std::vector<int> a)
{
vector<int> c(m + 1, -1);
c[0] = a.front();
a.erase(a.begin());
a.push_back(0);
int n = a.size(), p = 1;
while (p < n) p *= 2;
if (p == 1) ++p;
int delta = p - n, ind = 0;
vector<array<int, 2>> adj{{0, 0}};
auto dfs = [&delta, &adj, &ind](auto self, int h) -> int
{
if (h == -1) return 0;
++ind;
int v = ind;
adj.push_back({0, 0});
if (delta & (1 << h))
{
delta ^= 1 << h;
adj[v][0] = -1;
}
else adj[v][0] = -self(self, h - 1);
adj[v][1] = -self(self, h - 1);
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... |