图论
乐行僧丶
这个作者很懒,什么都没留下…
展开
-
PAT(甲级)1003.Emergency(25)
PAT 1003.Emergency(25) As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams...原创 2019-04-10 17:53:17 · 241 阅读 · 0 评论 -
PAT(甲级)1030.Travel Plan(30)
PAT 1030.Travel Plan(30) A traveler’s map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to d...原创 2019-04-10 20:17:58 · 354 阅读 · 0 评论 -
拓扑排序
AcWing848.有向图的拓扑序列 #include <iostream> #include <cstring> #include <vector> #include <queue> using namespace std; const int N=1e5+10; int n, m; vector<int> G[N]; int ind...原创 2019-08-24 10:33:29 · 123 阅读 · 0 评论 -
最短路径:dijkstra算法
#include <iostream> using namespace std; #define N 510 #define INF 0x3f3f3f3 int g[N][N]; int dist[N]; bool st[N]; int n, m; //返回值为1到n的路径长度 int dijkstra() { memset(dist, INF, sizeof dist); ...原创 2019-08-24 22:34:59 · 190 阅读 · 0 评论 -
数据结构:最小生成树算法模板prim和kruskal(考研)
1.prim #include <iostream> #include <cstring> #include <algorihtm> using namespace std; const int N=510; const int INF=0x3f3f3f3f; int dist[N];//保存距离 bool st[N];//标记点是否已经被访问过 int g[...原创 2019-08-22 17:34:15 · 903 阅读 · 0 评论