摘要: 基础款并查集练习题 // 13'11" #include <bits/stdc++.h> using namespace std; const int N = 1e4 + 10; int p[N], f[N]; void init() { for(int i = 1; i <= N; ++ i) p 阅读全文
posted @ 2024-08-29 22:22 Frodnx 阅读(10) 评论(0) 推荐(0)
摘要: 时间复杂度 N*M≈2.5e6 #include <bits/stdc++.h> using namespace std; int n = 510, m; const int N = 510; vector<pair<int,int>> path; // 储存所有边 int p[N]; // 储存祖 阅读全文
posted @ 2024-08-29 22:02 Frodnx 阅读(11) 评论(0) 推荐(0)
摘要: #include <bits/stdc++.h> using namespace std; const int N = 1000; int p[N]; int find(int x) { if(p[x] != x) p[x] = find(p[x]); return p[x]; } int main 阅读全文
posted @ 2024-08-29 19:45 Frodnx 阅读(10) 评论(0) 推荐(0)