The longest edge of all paths on the first point to the second point
The deformation of the Dijkstra is the longest side of each side path, each slack.
WA several times because the use of%LF changed to%f ...
1 /* ***********************************************2 Author:sunyuefeng3 Created TIME:2016/10/22 14:18:064 File name:a.cpp5 ************************************************ */6 7#include <cstdio>8#include <iostream>9#include <algorithm>Ten#include <cmath> One#include <cstring> A#include <string> -#include <bitset> -#include <map> the#include <Set> -#include <stack> -#include <vector> -#include <queue> +#include <list> - #defineM (A, B) memset (A,b,sizeof (a)) + using namespacestd; AtypedefLong Longll; at Const intinf=0x3f3f3f3f; - Const intmaxn=2e2+Ten; - Const intmod=1e7+7; - intdx[8]= {0,0,1,-1,1,-1,1,-1}; - intdy[8]= {1,-1,0,0,-1,1,1,-1}; - in intn,m; - DoubleWAY[MAXN][MAXN]; to DoubleDIS[MAXN]; + BOOLVIS[MAXN]; - the structpoint{ * intx, y; $ DoubleDist (Point a) {Panax Notoginseng returnsqrt ((x-a.x) * (x-a.x) + (Y-A.Y) * (ya.y)); - } the }PT[MAXN]; + A voidDijkstraintx) { the for(intI=0; i<n;i++){ +dis[i]=way[0][i]; -vis[i]=false; $ } $dis[x]=0; - for(intI=0; i<n;i++){ - intk=-1; the Doublemin=inf; - for(intj=0; j<n;j++){Wuyi if(!vis[j]&&dis[j]<min) { themin=Dis[j]; -k=J; Wu } - } About if(k==1) Break; $vis[k]=true; - for(intj=0; j<n;j++){ - if(!vis[j]&&dis[j]>Max (Dis[k],way[j][k])) { -dis[j]=Max (dis[k],way[j][k]); A } + } the } -printf"Frog Distance =%.3f\n\n", dis[1]); $ } the the intMain () the { the //freopen ("In.txt", "R", stdin); - //freopen ("OUT.txt", "w", stdout); in int_case=1; the while(~SCANF ("%d", &n) &&N) { theprintf"Scenario #%d\n", _case++); About for(intI=0; i<n;i++) the for(intj=0; j<n;j++) theway[i][j]=inf; the for(intI=0; i<n;i++) +scanf"%d%d",&pt[i].x,&pt[i].y); - for(intI=0; i<n;i++){ the for(intj=0; j<n;j++){Bayi if(I==J)Continue; theway[i][j]=pt[i].dist (Pt[j]); theway[j][i]=pt[i].dist (Pt[j]); - } - } theDijkstra0); the } the return 0; the}
[Kuangbin take you to fly] topic four shortest short practice POJ 2253 Frogger