#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
const int nx=2e5+1000;
int cnt, mx, used, id;
vector<int> v, X(nx), Y(nx), nv;
void add(int idx, int layer)
{
used=max(used, idx);
if (layer==mx)
{
if (cnt>=1) Y[idx-1]=v[cnt--], X[idx-1]=v[cnt--];
else if (cnt==0) Y[idx-1]=v[cnt--], X[idx-1]=-1;
}
else
{
int sid=id+1;
add(++id, layer+1);
Y[idx-1]=-sid;
sid=id+1;
if (cnt>=0) add(++id, layer+1), X[idx-1]=-sid;
else X[idx-1]=-1;
}
}
void create_circuit(int M, std::vector<int> A) {
vector<int> C(M+1);
for (int i=0; i<=M; i++) C[i]=-1;
v=A;
v.push_back(0);
int N=v.size();
cnt=N-1; mx=ceil(log2(N));
reverse(v.begin(), v.end());
for (int i=0; i<(1<<mx); i++)
{
int vl=0;
for (int j=mx-1; j>=0; j--)
{
if ((i/(1<<j))%2!=0) vl+=(1<<(mx-j-1));
}
if (vl<N) nv.push_back(v[vl]);
}
v=nv;
reverse(v.begin(), v.end());
add(++id, 1);
X.resize(used); Y.resize(used);
answer(C, X, Y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1880 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1880 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1880 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1884 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1884 KB |
Output is correct |
2 |
Correct |
61 ms |
6608 KB |
Output is correct |
3 |
Correct |
60 ms |
6604 KB |
Output is correct |
4 |
Correct |
75 ms |
9180 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1884 KB |
Output is correct |
2 |
Correct |
61 ms |
6608 KB |
Output is correct |
3 |
Correct |
60 ms |
6604 KB |
Output is correct |
4 |
Correct |
75 ms |
9180 KB |
Output is correct |
5 |
Incorrect |
79 ms |
10388 KB |
wrong motion |
6 |
Halted |
0 ms |
0 KB |
- |