이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |