版本比较
CF755F
正文
增加 3 行删除 3 行
115 行未改动全部展开1161171181191201211221231241251261271281295 行未改动13513613713813914014114214341 行未改动115 行未改动全部展开~~我代码写得太差了,建议大家参考其他题解的代码。~~```cpp#include <bits/stdc++.h>using namespace std;const int N = 1e6 + 5;int n, p[N], cnt[N], len, k, ans;int c[N], l, a[N], mx, f[N * 10];//f 开 1e7 是因为二进制拆分会产生 nlogn 个数。但到不了极限。bool v[N];inline int dfs(int x) {//处理出环的中有多少个点。v[x] = 1;if (v[p[x]]) return 1;return dfs(p[x]) + 1;5 行未改动a[++l] = j * v;x -= j;}}int main() {ios::sync_with_stdio(0);cin >> n >> k;for (int i = 1; i <= n; i++) cin >> p[i];41 行未改动115 行未改动全部展开1161171181191201211221231241251261271281295 行未改动13513613713813914014114214341 行未改动115 行未改动全部展开~~我代码写得太差了,建议大家参考其他题解的代码。~~```cpp#include <bits/stdc++.h>using namespace std;const int N = 1e6 + 5;int n, p[N], cnt[N], len, k, ans;int c[N], l, a[N], mx, f[N * 10];//f 开 1e7 是因为二进制拆分会产生 nlogn 个数。但到不了极限。bool v[N];inline int dfs(int x) {//处理出环的中有多少个点。v[x] = 1;if (v[p[x]]) return 1;return dfs(p[x]) + 1;5 行未改动a[++l] = j * v;x -= j;}}int main() {ios::sync_with_stdio(0);cin >> n >> k;for (int i = 1; i <= n; i++) cin >> p[i];41 行未改动