摘要: 循环n次,每次用离源点最近的点去更新源点到其他点的距离。 #include<iostream> #include<cstring> using namespace std; const int N = 510; int dist[N]; int d[N][N]; int st[N]; int n, 阅读全文
posted @ 2020-08-30 18:35 yys_c 阅读(83) 评论(0) 推荐(0) 编辑
摘要: 按边权把边从小到大排序 用并查集加边 检查是否为连通图 #include<iostream> #include<algorithm> using namespace std; const int N = 100010, E = 200010; struct edge{ int a, b, w; bo 阅读全文
posted @ 2020-08-30 11:21 yys_c 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 本题练习离散化,二分找位置,数组去重。 #include<iostream> #include<algorithm> using namespace std; const int N = 100010; struct node{ int x, c; }nodes[N]; int n, m, k = 阅读全文
posted @ 2020-08-30 10:58 yys_c 阅读(96) 评论(0) 推荐(0) 编辑