#include "doll.h"
#include <iostream>
#include <array>
#include <vector>
#define ll int
using namespace std;
ll n, k, cnt;
bool B[400000];
vector <ll> C, X, Y;
ll solve(ll l, ll r) {
if (l == r && n >= l) return 0;
ll id = cnt++, mid = (l+r)/2;
//cout << id << " " << l << " " << r << endl;
X.push_back(-1);
Y.push_back(-1);
if (n < l) {
X[id] = -(id+1);
Y[id] = -1;
return id+1;
}
X[id] = -solve(l, mid);
Y[id] = -solve(mid+1, r);
//cout << id << "*" << X[id] << " " << Y[id] << endl;
return id+1;
}
void get(ll x) {
x *= -1;
--x;
if (!B[x]) {
B[x] ^= 1;
if (X[x] != 0) get(X[x]);
else {
X[x] = k;
return;
}
}
else {
B[x] ^= 1;
if (Y[x] != 0) get(Y[x]);
else {
Y[x] = k;
return;
}
}
}
void create_circuit(int M, std::vector<int> A) {
n = A.size() + 1;
for (int i=0; i<=M; ++i) C.push_back(-1);
for (int i=18; i>=0; --i) {
if (n <= (1LL << i)) k = (1LL << i);
}
solve(1, k);
for (int i=1; i<n; ++i) {
k = i;
get(-1);
}
k = 0;
get(-1);
answer(C, X, Y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
wrong serial number |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
440 KB |
wrong serial number |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
440 KB |
wrong serial number |
2 |
Halted |
0 ms |
0 KB |
- |