样例能过
by HotDogSeller @ 2022-08-21 14:57:03
@[BTOI](/user/540822) SDNetFriend?
by whoam @ 2022-08-21 15:05:57
??? 我不理解 @[whoam](/user/549418)
by HotDogSeller @ 2022-08-21 15:08:29
@[BTOI](/user/540822) 五香边, `e[]` 需要开双倍空间
by LordLaffey @ 2022-08-21 15:11:09
建议不要尝试使用 `vector` 建立线段树,非常容易 `RE` ,请使用正版动态开点,或使用指针
by LordLaffey @ 2022-08-21 15:13:32
@[LordLaffey](/user/335136) 所以正版动态开点是用什么?
by HotDogSeller @ 2022-08-21 15:19:19
我这还盗版的我......(汗)
by HotDogSeller @ 2022-08-21 15:19:44
@[BTOI](/user/540822) ~~为什么会把动态开点理解成动态开数组呢...~~
每走到一个节点动态分配节点编号,保证数组大小在一个可以接受的范围内即可。
```cpp
void add(int &i){
if(!i) i=++tot;
}
by LordLaffey @ 2022-08-21 15:22:19
空间复杂度 $O(n \log V)$ ,$V$ 是线段树长度
by LordLaffey @ 2022-08-21 15:23:33
@[LordLaffey](/user/335136) [改过的代码在这里](https://www.luogu.com.cn/paste/kl1e5rkw)
好诶,之前RE的测试点全部变成了WA!求调。qwq
by HotDogSeller @ 2022-08-21 16:13:27