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>
#define rep(i,n)for(int i=0;i<int(n);i++)
using namespace std;
static vector<int>rec(vector<int>v){
if(v.size()==2)return v;
vector<int>a,b;
rep(i,v.size()){
if(i%2==0)a.push_back(v[i]);
else b.push_back(v[i]);
}
auto an=rec(a);
auto bn=rec(b);
for(int i:bn)an.push_back(i);
return an;
}
void create_circuit(int M, std::vector<int> A) {
A.push_back(0);
int N = A.size();
int n=2;while(n<N)n<<=1;
n>>=1;
vector<int>C(M+1);
vector<int>X(2*n-1),Y(2*n-1);
vector<int>idxn(2*n);
rep(i,2*n)idxn[i]=i;
auto idx=rec(idxn);
abort();
for(int i=1;i<=2*n-1;i++){
if(i<=n-1){
X[i-1]=-(i*2);
Y[i-1]=-(i*2+1);
}
else{
int d=i-n;
int l=idx[2*d],r=idx[2*d+1];
if(l<N-1||l==2*n-1){
X[i-1]=A[l<N-1?l:N-1];
}
else X[i-1]=-1;
if(r<N-1||r==2*n-1){
Y[i-1]=A[r<N-1?r:N-1];
}
else Y[i-1]=-1;
}
}
rep(i,M+1)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... |