正文
增加 1 行删除 1 行
973 行未改动全部展开974975976977978979980981982703 行未改动全部展开973 行未改动全部展开$$a^b\equiv\begin{cases}a^b & b<\varphi(p)\\a^{b\bmod \varphi(p)+\varphi(p)} & b\ge \varphi(p)\end{cases} \pmod p$$所以每个数最多只需要 $O(\log V)$ 次变换就可以变成定值,拿个 `set` 维护没有变成定值的位置,暴力修改到 BIT 上即可。703 行未改动全部展开973 行未改动全部展开974975976977978979980981982703 行未改动全部展开973 行未改动全部展开$$a^b\equiv\begin{cases}a^b & b<\varphi(p)\\a^{b\bmod \varphi(p)+\varphi(p)} & b\ge \varphi(p)\end{cases} \pmod p$$所以每个数最多只需要 $O(\log V)$ 次变换就可以变成定值,拿个 `set` 维护没有变成定值的位置,暴力修改到 BIT 上即可。703 行未改动全部展开