摘要:
给定长度 $n\leq10^5$ 的序列 $\{a_i\}$($a_i\leq10^6$),初始 $v = 1$,可至多 10^5 次乘除 $\text{lcm}\{b\}$($\sum |b| \leq 10^6$)使 $v$ 变为 $\gcd\{a_i \times a_j\}$。思路:考虑质因数指数(10^6 内最多 7 种),操作对应指数加减。用 min - max 容斥将 $\gcd\{a_i \times a_j\}$ 转化为 $\gcd$、$\text{lcm}$ 乘除,把最小和次小指数表示为 $(\gcd\{a_i\})^2 \prod_i \frac{\gcd_{i \neq j \{a_j\}}}{\gcd\{a_j\}}$,操作数约 $2^8 + 8 \times 2^8$,复杂度 $O(n\log n + n \omega(\sqrt{a}) + \sqrt{a})$。 阅读全文
posted @ 2025-02-18 22:01
wing_heart
阅读(16)
评论(0)
推荐(0)

浙公网安备 33010602011771号