# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
147106 | dolphingarlic | Mechanical Doll (IOI18_doll) | C++14 | 146 ms | 10396 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
int N, P = 1, switches = 1;
vector<int> X(1<<19), Y(1<<19);
bool state[1<<19];
int build(int l, int r) {
if (l >= r) return 0;
if (r < P - N) return -1;
int ts = switches++, mid = (l + r) / 2;
X[ts - 1] = build(l, mid);
Y[ts - 1] = build(mid + 1, r);
return -ts;
}
void point(int i, int j) {
int &a = state[-i] ? Y[-i - 1] : X[-i - 1];
state[-i] = !state[-i];
if (!a) a = j;
else point(a, j);
}
void create_circuit(int M, vector<int> A) {
N = A.size();
while (P < N) P *= 2;
# | 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... |