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 <bits/stdc++.h>
#include "doll.h"
using namespace std;
const int N = 2e5;
const int LOGN = 17;
vector<int> C(0), X(0), Y(0);
void create(vector<int> A,int u,int si){
if(si == 2){
X[u - 1] = A[0];
Y[u - 1] = A[1];
return;
}
vector<int> left;
vector<int> right;
int i = 1;
for(auto x : A){
if(i % 2 == 0){
right.push_back(x);
} else {
left.push_back(x);
}
++i;
}
X[u - 1] = -(2 * u);
Y[u - 1] = -(2 * u + 1);
create(left, 2 * u, si / 2);
create(right, 2 * u + 1, si / 2);
return;
}
void create_circuit(int M, std::vector<int> A) {
int n = A.size();
int nExp = 0;
C.assign(M + 1, 0);
for(int e = 0; e <= LOGN + 1; ++e){
if((1 << e) > n){
nExp = e;
break;
}
}
X.assign((1 << nExp) - 1, 0);
Y.assign((1 << nExp) - 1 ,0);
A.resize(1 << nExp);
for(int i = n; i < (1 << nExp); ++i){
A[i] = -1;
}
A[(1 << nExp) - 1] = 0;
create(A, 1, (1 << nExp));
for(int i = 0; i < n - 1; ++i){
C[i] = -1;
}
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... |