#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
using ll = int;
const ll inf = 1e8;
void create_circuit(int M, std::vector<int> A){
int N = A.size();
std::vector<int> C(M + 1, 0);
C[0] = A[0];
if (N == 1){
for (int i = 1; i <= M; ++i)
C[i] = 0;
vector<int> X, Y;
answer(C, X, Y);
return;
}
for (int i = 1; i <= M; ++i){
C[i] = -1;
}
ll GN = 1 << (__lg(N - 1) + 1);
A.push_back(0);
vector<int> X,Y;
ll it = 0;
function<ll(ll, ll)> dfs;
dfs = [&](ll cnt, ll width){
if (cnt == 1){
return inf;
}
ll i = it++;
X.emplace_back();
Y.emplace_back();
if (width>=cnt*2){
X[i] = -1;
Y[i] = dfs(cnt,width/2);
}else{
ll leftsize = 1<<__lg(cnt-1);
X[i] = dfs(leftsize,leftsize);
Y[i] = dfs(cnt-leftsize,leftsize);
}
return -1 - i;
};
dfs(N, GN);
ll ait = 1;
ll cur = -1;
vector<ll> stat(X.size(),0);
while(ait<=N){
ll *to;
if (stat[-cur-1]){
to = &Y[-cur-1];
}else{
to = &X[-cur-1];
}
stat[-cur-1]^=1;
if (*to == inf){
*to = A[ait++];
cur = -1;
}else{
cur = *to;
}
}
answer(C, X, Y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
296 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1084 ms |
212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1084 ms |
212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |