/**
[最短路]poj 3594
求起点到终点的最短时间耗费,每条路限制只在一定的时间范围内可以通行。
最优起始时间不确定,故需要枚举。
*/
#include <stdio.h>
#include <string.h>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;
#define INF 100000000
#define N 101
struct node
{
int u,d,s,e;
node(int a = 0,int b = 0,int c = 0,int f = 0)
{
u = a;
d = b;
s = c;
e = f;
}
}p;
vector<node> g[N];
int vis[N],d[N],n,m,src,dst;
bool operator<(const node &pp,const node &pt)
{
return pp.d > pt.d;
}
int dij(int t)
{
int i;
memset(vis,0,sizeof(vis));
for(i = 0; i <= n; ++i)
d[i] = INF;
p = node(src,t);
d[src] = t;
priority_queue<node> que;
que.push(p);
int u,v,w;
while(!que.empty())
{
p = que.top();
que.pop();
u = p.u;
if(vis[u])
[最短路]POJ 3594 Escort of Dr. Who How#最短路+枚举
最新推荐文章于 2017-02-11 11:33:17 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)