貌似归并排序的时候vector用迭代器访问会快一点?
by yql123456 @ 2021-12-07 21:51:28
![](//图.tk/gg) 鱼 ![](//图.tk/gh)
by Electro_Master @ 2021-12-07 22:03:21
好像还有个原因,我线段树的每个节点为了方便使用struct存的,像这样
```cpp
struct nod{int len,sum,op,h,t,hlen,tlen,p,la1,la2;ll ji,hji,tji,ans;vector<pii> tp;};
struct tree{nod tr[N<<2];}tr;
```
如果pushup直接返回一个struct,vector的赋值会很慢,还会TLE两个点
```cpp
inline nod pushup(nod a,nod b,int op)
```
但要是这样写,就快的起飞。。。(常数--)
```cpp
inline void pushup(nod &x,nod a,nod b,int op)
```
by flying_luzy_fish @ 2021-12-09 11:38:10