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>
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define pb push_back
using namespace std;
#include "doll.h"
int n;
vector<int> C, X(1, 1e9), Y(1, 1e9);
vector<int> vis(1e6, 0);
int l;
int new_node(){
X.pb(1e9);
Y.pb(1e9);
return sz(X) - 1;
}
int build(int x, int d, int v){
if(d == l) return v;
if(x == 1e9) x = new_node();
else x = -x - 1;
vis[x]++;
if(vis[x] % 2){
int k = build(X[x], d + 1, v);
X[x] = k;
}
else{
int k = build(Y[x], d + 1, v);
Y[x] = k;
}
return -x - 1;
}
void create_circuit(int M, std::vector<int> A) {
n = A.size();
C = vector<int>(M + 1, -1);
l = ceil(log2(n + 1));
for(auto x : A){
build(-1, 0, x);
}
for(int i = n + 1; i < (1 << l); i++) build(-1, 0, -1);
build(-1, 0, 0);
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... |