QOJ.ac

QOJ

Type: Editorial

Status: Open

Posted by: jiangly

Posted at: 2025-12-13 00:06:34

Last updated: 2025-12-13 00:06:40

Back to Problem

题解

容易发现要求的是 Nimber 积和式,也即行列式。高斯消元即可,复杂度为 $O(n^3)$ 次 Nimber 乘法。

要注意的地方:

  • $x\pod{x < 2^{2^n}}$ 的逆元即为 $x^{2^{2^n}-2}$。
  • 用普通的 $O(\log x\log y)$ 的乘法无法通过,可能的解决办法有:
    • 分治乘法并预处理较小范围的乘积。
    • 注意到瓶颈的 $O(n^3)$ 次乘法不同的乘数只有 $O(n^2)$ 个,每次预处理 $x$ 和 $2^0,2^1,\ldots,2^{63}$ 的乘积即可做到 $O(\log y)$ 乘法。

Comments

No comments yet.