文章
25
粉丝
137
获赞
7
访问
128.6k
#include<iostream>
#include<vector>
#include<algorithm>
#define INF 100000
using namespace std;
typedef struct node {
int order;
int to;
int dist;
bool use;
node(int o, int a, int b,bool u) :order(o), to(a), dist(b), use(u){ }
}Node;
vector<Node> vec[51];
int Dijkstra(int start,int n) {
int dist[51],mindist = INF;
fill(dist, dist + 51, INF);
int visited[51];
fill(visited, visited + 51, 0);
visited[start] = 1;
dist[start] = 0;
for (auto it : vec[start]) {
if(it.use && dist[it.to] > it.dist)
dist[it.to] = it.dist;
}
for (int i = 1; i < n; ++i) {
&nbs...
登录后发布评论
暂无评论,来抢沙发