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"
#ifndef EVAL
#include "grader.cpp"
#endif
#include <bits/stdc++.h>
using namespace std;
vector<int> C, X(1 << 18, -1), Y(1 << 18, -1);
vector<bool> tree((1 << 18) + 5, true);
void rec(int index, int value)
{
if (index >= 1 << 17)
{
cout << index - 1 << " ";
if (tree[index])
X[index - 1] = value;
else
Y[index - 1] = value;
}
else if (tree[index])
rec(index * 2, value);
else
rec(index * 2 + 1, value);
tree[index] = !tree[index];
}
void create_circuit(int M, std::vector<int> A)
{
int N = A.size();
C.resize(M + 1);
fill(C.begin(), C.end(), -1);
for (int i = 1; i < 1 << 17; i++)
{
X[i - 1] = i * -2;
Y[i - 1] = i * -2 - 1;
}
for (int i : A)
rec(1, i);
Y[262142] = 0;
answer(C, X, Y);
}
Compilation message (stderr)
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:31:7: warning: unused variable 'N' [-Wunused-variable]
31 | int N = A.size();
| ^
# | 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... |