# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
601627 | Mazaalai | Mechanical Doll (IOI18_doll) | C++17 | 172 ms | 12188 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>
#define sz(x) (int)x.size()
#define ALL(x) x.begin(), x.end()
#define pb push_back
#define ff first
#define ss second
using namespace std;
using VI = vector <int>;
using PII = pair <int, int>;
int n, m, p = 1;
const int N = 4e5;
VI c, x(N), y(N), state(N);
int switchNo;
int generate(int l, int r) {
if (r < p-n-1) {
return -1;
}
if (l == r) {
return 0; // up or down
}
int mid = (l+r)>>1, curNode = ++switchNo;
x[curNode] = generate(l, mid);
y[curNode] = generate(mid+1, r);
return -curNode;
}
void addPos(int pos, int v) { // removes n zero
int& nx = (state[-pos] ? y[-pos] : x[-pos]); state[-pos] ^= 1;
if (nx == 0) {
# | 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... |