이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void create_circuit(int m, std::vector<int> a) {
a.push_back (0);
int n = a.size (), vt = 1;
while (vt < n) vt <<= 1;
int ivt = 1e9, ust;
vector < int > c (m + 1), x, y;
auto f = [&] (auto &self, int l, int r) -> int
{
if (r <= 0) return ivt;
if (l + 1 == r) return ust;
int m = (l + r) / 2;
int a = self (self, l, m), b = self (self, m, r);
x.push_back (a), y.push_back (b);
return -x.size ();
};
int fs = f (f, n - vt, n);
for (auto &x : c) x = fs;
for (auto &xx : x) if (xx == ivt) xx = fs;
for (auto &xx : y) if (xx == ivt) xx = fs;
int ai = 0;
vector < bool > st (x.size ());
for (int i = 0; i < n; ++i)
for (int *i = &fs; ; st[-(*i + 1)] = !st[-(*i + 1)],
i = st[-(*i + 1)] ? &x[-(*i + 1)] : &y[-(*i + 1)])
if (*i == ust)
{
*i = a[ai++];
break;
}
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... |