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;
vector<vector<int>> adjlist;
vector<int> exitto;
vector<int> switchxto;
vector<int> switchyto;
int sind = 0;
int l2;
int getcomp(int v){
int ans = 0;
for (int i = 0; i<l2; i++){
if ((1<<i)&v){
ans+=1<<(l2-i-1);
}
}
return ans;
}
void create_circuit(int m, std::vector<int> a) {
int n = a.size();
if (1<<(int(log2(n-1)+1))==n){n++;}
l2 = log2(n-1)+1;
int powtwo = 1<<(l2);
switchxto.resize(powtwo-1);
switchyto.resize(powtwo-1);
for (int i = 1; i<=powtwo-1; i++){
switchxto[i-1]=-2*i;
switchyto[i-1]=-2*i-1;
}
a.resize(powtwo,-1);
a[powtwo-1]=0;
for (int i = 0; i<powtwo/2; i++){
switchxto[powtwo/2+i-1]=a[getcomp(2*i)];
switchyto[powtwo/2+i-1]=a[getcomp(2*i+1)];
}
/*for (int i : switchxto){
cout<<i<<' ';
}cout<<'\n';
for (int i : switchyto){
cout<<i<<' ';
}cout<<'\n';
for (int i : a){
cout<<i<<' ';
}cout<<'\n';*/
exitto.resize(m+1,-1);
answer(exitto,switchxto,switchyto);
}
# | 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... |