题目大意: 给你以T, 代表T组测试数据,一个n代表有n个点, 一个m代表有m条边, 每条边有三个参数,a,b,c表示从a到b的这条路上最大的承受重量是c, 让你找出一条线路,要求出在这条线路上的最小承重, 在所有其他线路最大. 题目分析: 这里只要将spfa进行一下变形就可以解决这问题了. 首先 我们的dist数组,起点位置要初始化为 INF, 其他位置初始化为 0 然后我们更新 dist 数组, 结果输出 dist[n]就行了 为什么这样写: 因为我们每次要找 所有路径中的最大边的最小一个,…
Heavy Transportation POJ 1797 最短路变形 题意 原题链接 题意大体就是说在一个地图上,有n个城市,编号从1 2 3 ... n,m条路,每条路都有相应的承重能力,然后让你求从编号为1的城市到编号为n的城市的路线中,最大能经过多重的车. 解题思路 这个题可以使用最短路的思路,不过转移方程变了\(dis[j]=max(dis[j], min(dis[u], e[u][j]))\).这里dis[j]表示从标号为1的点到达编号为j的点的路径中,最小的承重能力,就像短板效应样…
题目链接:http://poj.org/problem?id=1797 题意:给定n个点,m条边,每条边连接两点切有权值.求点1到点n的路径的上的最小边的值最大... 翻别人博客找到的题,方法挺多的,直接跑一个最大生成树就行,或者是一个最短路算法也行 我自己用了prim和kruskal 的方法来做 虽然用最短路也可以轻松过,但是我还是选择了生成树 prim #include<cstdio> #include<cmath> #include<algorithm> #inc…
题目电波: POJ--1797 Heavy Transportation n点m条边, 求1到n最短边最大的路径的最短边长度 改进dijikstra,dist[i]数组保存源点到i点的最短边最大的路径的最短边长度 #include<iostream> #include<cstring> #include<algorithm> #include<stdio.h> using namespace std; #define maxn 100010 #define…
题目链接:http://poj.org/problem?id=1797 Heavy Transportation Time Limit: 3000MS   Memory Limit: 30000K Total Submissions: 39999   Accepted: 10515 Description Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand…
传送门 Heavy Transportation Time Limit: 3000MS   Memory Limit: 30000K Total Submissions: 31882   Accepted: 8445 Description Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever…
Heavy Transportation Time Limit: 3000MS   Memory Limit: 30000K Total Submissions: 53170   Accepted: 13544 Description Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man…
Heavy Transportation Time Limit: 3000MS   Memory Limit: 30000K Total Submissions: 21037   Accepted: 5569 Description Background  Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man…
传送门 1.最大生成树 可以求出最大生成树,其中权值最小的边即为答案. 2.最短路 只需改变spfa里面的松弛操作就可以求出答案. ——代码 #include <queue> #include <cstdio> #include <cstring> using namespace std; ; int T, n, m, cnt; int head[MAXN], next[MAXN * MAXN], to[MAXN * MAXN], val[MAXN * MAXN], d…
Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there really is a way from the place his customer has build his giant steel crane to the place…