Title Link: http://poj.org/problem?id=3615
Test instructions: Approximate test instructions: There is a height difference between N Stakes and M Stakes (from X to y the height to jump upwards). The physical value that is consumed by the path from X to Y is a maximum height difference in the path. Find a path that consumes the least amount of energy.
#include <stdio.h>#include<string.h>#include<algorithm>using namespacestd;#defineINF 0x3f3f3f3fintdis[ -][ -];intMain () { for(intI=0;i< the; i++) for(intj=0;j< the; j + +) Dis[i][j]=INF; intn,m,t; scanf ("%d%d%d",&n,&m,&t); inta,b,d; for(intI=0; i<m;i++) {scanf ("%d%d%d",&a,&b,&d); DIS[A][B]=D; } for(intk=1; k<=n;k++) for(intI=1; i<=n;i++) for(intj=1; j<=n;j++) Dis[i][j]=min (Dis[i][j],max (dis[i][k],dis[k][j)); intx, y; for(intI=0; i<t;i++) {scanf ("%d%d",&x,&y); if(dis[x][y]==INF) puts ("-1"); Elseprintf"%d\n", Dis[x][y]); } return 0;}
Poj (3615), Floyd, minimum value in maximum