제출 #601627

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
6016272022-07-22 08:46:28MazaalaiMechanical Doll (IOI18_doll)C++17
100 / 100
172 ms12188 KiB
#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) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...