版本比较
可持久化线段树/主席树 学习笔记
正文
增加 3 行删除 3 行
96 行未改动979899100101101102103104105104 行未改动全部展开210211212213214214215216217218400 行未改动全部展开619620621622623623624625626627169 行未改动全部展开96 行未改动 printf("%d\n",Find(root[rt],1,n,loc)); root[i]=root[rt]; } }} }```## P3834 【模板】可持久化线段树 2[Link](https://www.luogu.com.cn/problem/P3834)
104 行未改动全部展开 scanf("%d%d%d",&ll,&rr,&kk); int to=Find(root[rr],root[ll-1],1,n,kk); printf("%d\n",a[to].val); }} }```
## P2468 [SDOI2010] 粟粟的书架[Link](https://www.luogu.com.cn/problem/P2468)400 行未改动全部展开 } sort(R+1,R+1+m); tot=unique(R+1,R+1+m)-R-1; sort(mod+1,mod+2*m+1,cmp);
root[0]=1; build(1,1,tot); int tis=1; for(int i=1;i<=m*2;i++)169 行未改动全部展开