@[luqyou](/user/464732) 数组太小啦
by _Imaginary_ @ 2023-03-11 21:46:10
@[wsfxk](/user/376161) 有道理,所以该怎么做
by luqyou @ 2023-03-11 21:47:06
直接在 $add$ 和 $del$ 里更新答案就行了吧,没必要开个 $set$.
还有,数组开小了
by bits47 @ 2023-03-11 21:47:40
@[luqyou](/user/464732) 数组开小了
by 2949767807qwer @ 2023-03-11 21:47:50
而且你代码是超时的,要在del,add里面更新答案
by Hell0_W0rld @ 2023-03-11 21:48:11
我的赛时代码:<https://atcoder.jp/contests/abc293/submissions/39625561>
by Hell0_W0rld @ 2023-03-11 21:48:49
@[luqyou](/user/464732) 而且你这复杂度是假的吧,用一个ans记录,每次-=C(cnt,3)再加上C(cnt+1/cnt-1,3)
by 2949767807qwer @ 2023-03-11 21:49:19
@[2949767807qwer](/user/577066) 然而不需要组合数吧
by yinhee @ 2023-03-11 21:50:52
+/- cnt[x-1]*cnt[x-2]/2
by yinhee @ 2023-03-11 21:51:32
我服了,你莫队哪儿学的
by Hell0_W0rld @ 2023-03-11 21:51:53