EDqwq @ 2021-01-27 09:50:27
https://www.luogu.com.cn/paste/r0jskotf
标题证明了我有多惨
by EDqwq @ 2021-01-27 10:24:31
(更改了一下:指剪切板)
by 鏡音リン @ 2021-01-27 10:26:06
@林深时x见鹿 这回看着还对劲点
by 鏡音リン @ 2021-01-27 10:28:10
我现在看不懂您这个rotate和splay的写法啊 您能不能照份正常点的代码抄啊
by EDqwq @ 2021-01-27 10:29:10
@鏡音リン 我搜的博客qwq
不知道什么事正常马蜂qaq
by 鏡音リン @ 2021-01-27 10:30:38
我怀疑您这这么短能对么 为啥我的死老长
void rotateL(node t) {
node nl = t->r->l;
int z = t->ssum;
t->ssum -= t->r->ssum;
t->r->ssum = z;
if (nl) t->ssum += nl->ssum;
t->r->l = t;
if (t == root) root = t->r;
else if (t == t->fa->l) t->fa->l = t->r;
else t->fa->r = t->r;
t->r->fa = t->fa;
t->fa = t->r;
t->r = nl;
if (nl) nl->fa = t;
}
void rotateR(node t) {
node nl = t->l->r;
int z = t->ssum;
t->ssum -= t->l->ssum;
t->l->ssum = z;
if (nl) t->ssum += nl->ssum;
t->l->r = t;
if (t == root) root = t->l;
else if (t == t->fa->r) t->fa->r = t->l;
else t->fa->l = t->l;
t->l->fa = t->fa;
t->fa = t->l;
t->l = nl;
if (nl) nl->fa = t;
}
void splay(node x, node y) {
while (x->fa != y) {
node p = x->fa;
node g = p->fa;
if (g == y) {
if (p->l == x) rotateR(p);
else rotateL(p);
} else if (g->l == p) {
if (p->l == x) {
rotateR(g);
rotateR(p);
} else {
rotateL(p);
rotateR(g);
}
} else {
if (p->r == x) {
rotateL(g);
rotateL(p);
} else {
rotateR(p);
rotateL(g);
}
}
}
}
by EDqwq @ 2021-01-27 10:31:33
@鏡音リン 我的平衡树模板和加强版都过了啊
而且我看好多人都这么写(
指针不会/kel
by 鏡音リン @ 2021-01-27 10:32:51
@林深时x见鹿 那我就不知道您啥问题了,您慢慢调,祝成功 /kk
by EDqwq @ 2021-01-27 10:33:43
铃看不懂我的代码我没救了
by FCB_1899 @ 2021-01-27 10:39:44
刚学OI三秒
又是fake,我自闭了
by Unordered_OIer @ 2021-01-27 10:44:20
@林深时x见鹿 您这个reserve写的是啥呀
splay左儿子和右儿子?
我看不懂了/kk /kk