- 博客(3)
- 收藏
- 关注
原创 专题四 · 1003
代码及解释#include <algorithm> #include <cmath> #include <cstdio> #include <iostream>// 上课讲的一道题 // 并查集的思考: // 一种并查集是上课的时候老师讲的 // 这种并查集的查询效率很快 // 但是更新的速度比较慢 // 实际上另外一种是查询效率慢 // 更新速度很快 // 这两种可以应用于不同的场景using s
2016-06-29 17:17:35 260
原创 专题四 · 1002
代码及解释#include <algorithm> #include <cmath> #include <cstdio> #include <iostream>// kruskal 求最小生成树,用到并查集struct Node { int x, y; double cost; } g[5005];int pre[105];int find(int n) { return n == pre[
2016-06-28 10:21:57 269
原创 专题四 · 1001
代码及解释#include <algorithm> #include <iostream>// // kruskal + 并查集 + 边表 //struct node { int from; int to; int w; };node edge[102 * 100]; int parent[102];bool cmp(node a, node b) { if (a.w <= b.w)
2016-06-13 20:45:17 277
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人