... and you are using CDQ:
本题树状数组值域的上限为 w = 2000000,你也许给开够了空间,但在 add 时 while(x<n) 了。
while(x<n)
根据讨论贴,以前因为同样原因未能 AC 的用户: @Soledad_S :(