平衡树要写splay,最简单
by Miss_SGT @ 2023-12-31 11:15:03
@[zhouchenqiao1](/user/705012) 这题FHQ写出来才简单吧
by keep_of_silence @ 2023-12-31 11:16:17
@[keep_of_silence](/user/567247) 对他而言是这样的
by Miss_SGT @ 2023-12-31 11:18:49
@[zhouchenqiao1](/user/705012) lc:wg都不学splay你们学什么,了解即可
by _7Mr @ 2023-12-31 11:18:50
```cpp
int Pre(int dq){
int l,r;
Split(root,dq-1,l,r);
root=Merge(l,r);
return sum(Kth(l,siz(l)));
}
int Next(int dq){
int l,r;
Split(root,dq,l,r);
root=Merge(l,r);
return sum(Kth(r,1));
}
```
你这里怎么先合并在求值啊?
by wuhupai @ 2023-12-31 11:20:04
@[luozhih](/user/602632) 这是怕你们弱小的心灵被splay伤害了,虽然我也不会
by Miss_SGT @ 2023-12-31 11:20:38
@[wuhupai](/user/544310) 这里改了,但是还是 Re 只有 23pts
by _7Mr @ 2023-12-31 11:21:08
```
l(dq)=r(dq)=0;
```
这里写错了,不应该是
````
l(cnt)=r(cnt)=0;
```
by keep_of_silence @ 2023-12-31 11:21:15
明显写错越界了@[luozhih](/user/602632)
by keep_of_silence @ 2023-12-31 11:22:29
@[keep_of_silence](/user/567247) 谢谢,已过
~~我是™大傻逼~~
by _7Mr @ 2023-12-31 11:22:42