摘要:
dijkstra简单变形,单目标和单源最短路的结合。poj1511类似View Code 1 #include <stdio.h> 2 #define MAXN 100010 3 #define MAX 1010 4 #define INF (1<<29) 5 int n,m,x; 6 struct node 7 { 8 int d,t; 9 node* next;10 }*h1[MAX],e1[MAXN],*p,*h2[MAX],e2[MAXN],*q;11 bool v[MAX];12 int t[MAX],sum,max[MAX];13 void input()1 阅读全文
摘要:
floyd水题,将map[i][j]理解为从i到j的路径中高度最小即可,将松弛条件改为map[i][j]=MIN(map[i][j],MAX(map[i][k],map[k][j]));好好理解一下吧View Code 1 #include <stdio.h> 2 #include <string.h> 3 #define MAXN 310 4 #define INF (1<<29) 5 #define MIN(a,b) ((a)<(b)?(a):(b)) 6 #define MAX(a,b) ((a)>(b)?(a):(b)) 7 int n, 阅读全文