# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
958414 | AkibAzmain | Mechanical Doll (IOI18_doll) | C++17 | 74 ms | 11080 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;
using ll = long long;
void create_circuit(int m, std::vector<int> a) {
int p = 0;
a.push_back (0);
vector < int > c (m + 1, -1), x, y;
x.reserve (a.size () * 2);
y.reserve (a.size () * 2);
int vt = 1, vtt = 0;
while (vt < a.size ()) vt *= 2, ++vtt;
vector < int > v (vt, -1);
for (int i = 0; i < a.size (); ++i)
{
int j = vt - a.size () + i, k = 0;
for (int i = 0; i < vtt; ++i) k = k * 2 + j % 2, j /= 2;
v[k] = a[i];
}
auto f = [&] (auto &self, int l, int r) -> int
{
if (l + 1 == r) return v[l];
int m = (l + r) / 2;
int i = x.size ();
x.push_back (0), y.push_back (0);
x[i] = self (self, l, m);
y[i] = self (self, m, r);
return -(i + 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... |