MnZn求助主席树板子题

P3168 [CQOI2015] 任务查询系统

写的可能有亿点丑![qq_emoji: kk](https://xn--9zr.tk/kk)
by Kappa6174 @ 2021-06-15 17:05:39


[提交记录在这](https://www.luogu.com.cn/record/51809190)
by Kappa6174 @ 2021-06-15 17:11:09


``` cpp int query(int p,int l,int r,int k) { if(l==r) { return t[p].sum/t[p].num*k; } int mid=l+r>>1; int V=t[t[p].l].num; if(k<=V)return query(t[p].l,l,mid,k); else return t[t[p].l].sum+query(t[p].r,mid+1,r,k-V); } ``` 被0除了哥 return t[p].sum/(t[p].num ? t[p].num : 1)*k;
by chenyilei @ 2021-06-15 18:00:24


@[chenyilei](/user/21001) 谢谢qwq
by Kappa6174 @ 2021-06-15 18:37:28


什么? @[MnZn](/user/632955) 你在哪
by Luckies @ 2023-08-23 09:35:24


@[Stephen__Curry](/user/520338) 6
by MnZn @ 2023-08-23 12:09:34


|