이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "doll.h"
#include <bits/stdc++.h>
#define ii pair<int,int>
#define F first
#define S second
using namespace std;
const int NN=3e5+100;
vector<int> c,x,y,a;
int sz;
void build(int p,int l,int sum)
{
if(sum*2>=sz){
x[p-1]=a[l];
y[p-1]=a[l+sum];
return;
}
x[p-1]=(-(p*2));
y[p-1]=(-(p*2+1));
build(p*2,l,sum*2);
build(p*2+1,l+sum,sum*2);
}
void create_circuit(int m,vector<int>A){
a=A;
sz=a.size();
if(a.size()==1){
c.resize(m+1);
c[0]=a[0];
answer(c,x,y);
return;
}
for(int i=0;i<=m;i++){
c.push_back(-1);
}
sz++;
a.push_back(-1);
while(1){
int u=log2(sz);
int v=log2(sz-1);
if(u>v){
break;
}
sz++;
a.push_back(-1);
}
a.pop_back();
a.push_back(0);
x.resize(sz*2);
y.resize(sz*2);
build(1,0,1);
while(x.back()==y.back()&&x.back()==0){
x.pop_back();
y.pop_back();
}
/*
cout<<sz<<endl;
for(auto x:c)cout<<x<<" ";cout<<endl;
for(auto xx:x)cout<<xx<<" ";cout<<endl;
for(auto x:y)cout<<x<<" ";cout<<endl;
*/
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... |