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;
typedef vector<int> vi;
namespace solution {
vi c, x, y;
int s;
vector<bool> e;
int generate_switch(int p) {
int i = s++;
x.push_back(0);
y.push_back(0);
e.push_back(false);
if(p) {
x[i] = generate_switch(p - 1);
y[i] = generate_switch(p - 1);
}
return -(i + 1);
}
void set_exit(int p, int v, int i = 0) {
int &j = (e[i] ? y : x)[i];
e[i] = !e[i];
if(p) {
set_exit(p - 1, v, -(j + 1));
} else {
j = v;
}
}
}
void create_circuit (int m, vi a) {
using namespace solution;
int n = a.size();
s = 0;
c.resize(m + 1);
e.clear();
x.clear();
y.clear();
int p = 0;
for(; 1 << p < n; ++p);
c[0] = a[0];
fill(c.begin(), c.end(), generate_switch(p));
int u = 1 << p;
for(int i = 1; i < n; ++i) {
--u;
set_exit(p, a[i]);
}
while(u > 1) {
--u;
set_exit(p, -1);
}
set_exit(p, 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... |