20200327 (DEF) Solution by Sun Chenxi

Solution to Problem D:
Use two tree arrays suma [N] and sumb [N] to maintain the sum of the first n items of a and b. When adding, the upper limit of daily addition is a and b.
For each query, the answer is sumb (pi-1) + (suma (n) -suma (pi + k-1))

 

Guess you like

Origin www.cnblogs.com/QLU-ACM/p/12672478.html