版本比较
此时此刻的光辉-加强版 题解
正文
增加 6 行删除 4 行
14 行未改动15161718191920212122232425142 行未改动全部展开16816917017117217217317417517617717817918018118018218318418518689 行未改动14 行未改动剩下就是基础的卡常。调块长、调筛的质数个数、调 Pollard-Rho 步长和 Miller-Rabin 判的质数个数、输入输出优化、规避类型转换、规避取模、多用常量。
类似这样子,吃评测波动可以跑的相当优秀。
下面是一个实现,最慢点 $3.85$ 秒,总用时 $6.21$ 秒:下面是一个实现,最慢点 $3.84$ 秒,总用时 $6.17$ 秒,可以不用卡波动,稳稳通过:
(Code by [Milky_Cat](https://www.luogu.com.cn/user/906320))(Code by [Milky_Cat](https://www.luogu.com.cn/user/906320),小奶猫怎么这么强 orz。)
```cpp#include<bits/stdc++.h>#include<ext/pb_ds/assoc_container.hpp>142 行未改动全部展开 else dfs(b, id);}inline void add(const int i){ for (auto tmp : vec[i]){ ll x = tmp.first; int x = tmp.first, cnt = tmp.second; int cnt = tmp.second; res = res * inv[mp[x] + 1] % mod; mp[x] += cnt; res = res * (mp[x] + 1) % mod; }}inline void del(const int i){ for (auto tmp : vec[i]){ ll x = tmp.first; int x = tmp.first, cnt = tmp.second; int cnt = tmp.second; res = res * inv[mp[x] + 1] % mod; mp[x] -= cnt; res = res * (mp[x] + 1) % mod; }89 行未改动