#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,-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);
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;
}
}
answer(C,X,Y);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
2 |
Partially correct |
151 ms |
12024 KB |
Output is partially correct |
3 |
Partially correct |
138 ms |
11844 KB |
Output is partially correct |
4 |
Partially correct |
146 ms |
12476 KB |
Output is partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
2 |
Partially correct |
151 ms |
12024 KB |
Output is partially correct |
3 |
Partially correct |
138 ms |
11844 KB |
Output is partially correct |
4 |
Partially correct |
146 ms |
12476 KB |
Output is partially correct |
5 |
Partially correct |
169 ms |
12620 KB |
Output is partially correct |
6 |
Partially correct |
148 ms |
12568 KB |
Output is partially correct |
7 |
Partially correct |
175 ms |
12580 KB |
Output is partially correct |
8 |
Partially correct |
175 ms |
12448 KB |
Output is partially correct |
9 |
Partially correct |
144 ms |
11996 KB |
Output is partially correct |
10 |
Partially correct |
148 ms |
12444 KB |
Output is partially correct |
11 |
Partially correct |
150 ms |
12552 KB |
Output is partially correct |
12 |
Partially correct |
185 ms |
11920 KB |
Output is partially correct |
13 |
Partially correct |
145 ms |
11964 KB |
Output is partially correct |
14 |
Partially correct |
142 ms |
11964 KB |
Output is partially correct |
15 |
Partially correct |
140 ms |
11964 KB |
Output is partially correct |
16 |
Partially correct |
5 ms |
660 KB |
Output is partially correct |
17 |
Correct |
77 ms |
7228 KB |
Output is correct |
18 |
Partially correct |
141 ms |
11932 KB |
Output is partially correct |
19 |
Partially correct |
152 ms |
11936 KB |
Output is partially correct |
20 |
Partially correct |
159 ms |
12496 KB |
Output is partially correct |
21 |
Partially correct |
179 ms |
12464 KB |
Output is partially correct |
22 |
Partially correct |
160 ms |
12404 KB |
Output is partially correct |