统计每个位置的贡献:左边(含自己)左括号等于右边(不含自己)右括号的方案数。
枚举哪两个相邻的点第一个碰撞,剩下的不能在其之前碰撞,修改转移矩阵。将枚举按碰撞时间有小到大排序就不用每次全部修改了。 利用 E = ∑ i = 1 P ( x = i ) ∗ i = ∑ i P ( x ≥ i ) E=\sum_{i=1}P(x=i)*i=\sum_iP(x\ge i) E=∑i=1P(x=i)∗i=∑iP(x≥i) 可以优化常数。
Tourial
至于为什么 The optimal strategy is to never random after buying any relic for its price. \color{grey}\text{The optimal strategy is to never random after buying any relic for its price.} The optimal strategy is to never random after buying any relic for its price. 就不知道了。。也许你可以看看CF里的讨论。虽然我看了还是不懂
把递归到的最底层序列拿出来看,把它分成若干个块。然后考虑每一对位置形成逆序对的概率。
单开了一篇
单开了一篇