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;
using ll = long long;
void create_circuit(int m, std::vector<int> a) {
int p = 0;
a.push_back (0);
vector < vector < int > > adj (m + 1);
for (auto &x : a) adj[p].push_back (x), p = x;
vector < int > c (m + 1), x, y;
x.reserve (a.size () * 2);
y.reserve (a.size () * 2);
for (int i = 0; i <= m; ++i)
{
if (adj[i].empty ()) continue;
auto f = [&] (auto &self, int &p, int l, int r) -> void
{
if (l + 1 == r) p = adj[i][l];
else
{
int m = (l + r) / 2;
x.push_back (0), y.push_back (0);
p = -x.size ();
self (self, x.back (), l, m);
self (self, y.back (), m, r);
}
};
f (f, c[i], 0, adj[i].size ());
}
answer (c, x, y);
}
# | 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... |