D题题解:分别用两个树状数组suma[N],sumb[N]维护a和b的前n项和。add的时候处理一下每天添加的上限分别是a和b。对于每次询问,答案为sumb(pi-1)+(suma(n)-suma(pi+k-1))