POJ.1797 Heavy Transportation (Dijkstra变形) 题意分析 给出n个点,m条边的城市网络,其中 x y d 代表由x到y(或由y到x)的公路所能承受的最大重量为d,求从1到n的所有通路中,所能经过的的最大重量的车为多少. 2. 代码总览 #include <cstdio> #include <cstring> #include <algorithm> #include <queue> #include <stack&…
题目链接:POJ 1797 Description 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…
题目:click here 题意: 有n个城市,m条道路,在每条道路上有一个承载量,现在要求从1到n城市最大承载量,而最大承载量就是从城市1到城市n所有通路上的最大承载量.分析: 其实这个求最大边可以近似于求最短路,只要修改下找最短路更新的条件就可以了. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #i…
http://poj.org/problem?id=1797 给定n个点,及m条边的最大负载,求顶点1到顶点n的最大载重量. 用Dijkstra算法解之,只是需要把“最短路”的定义稍微改变一下, A到B的路长定义为路径上边权最小的那条边的长度, 而最短路其实是A到B所有路长的最大值. #include<stdio.h> #include<string.h> #include<math.h> #include<stdlib.h> #include<alg…
POJ 1797 Heavy Transportation / SCU 1819 Heavy Transportation (图论,最短路径) Description 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 reall…
poj 1797 Heavy Transportation Description 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…
原题链接:http://poj.org/problem?id=1797 Heavy Transportation Time Limit: 3000MS   Memory Limit: 30000K Total Submissions: 24576   Accepted: 6510 Description Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand…
题目链接:http://poj.org/problem?id=1797 Heavy Transportation Time Limit: 3000MS   Memory Limit: 30000K Total Submissions: 30840   Accepted: 8191 Description Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand…
F - Heavy Transportation Time Limit:3000MS     Memory Limit:30000KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 1797 Description Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand busines…
传送门 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:30000KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 1797 Description Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. B…
Heavy Transportation 题目链接: http://acm.hust.edu.cn/vjudge/contest/66569#problem/A Description 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 th…
题目链接:POJ 1797 Description 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…
Heavy Transportation Time Limit: 3000MS   Memory Limit: 30000K Total Submissions: 26968   Accepted: 7232 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: 22440   Accepted: 5950 Description Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man…
传送门:http://poj.org/problem?id=1797 题意: 在起点和终点间找到一条路,使得经过的边的最小值是最大的: 和POJ2253类似,传送门:http://www.cnblogs.com/ckxkexing/p/8747108.html 思路: 跑一边dijkstra,每次松弛的条件改为:if( dis[tmp] < min(dis[v],tmpc) )dis[tmp] = min( dis[v] , tmpc); 注意这道题和POJ2253的区别在于每次选取的节点要最小…
题目链接: http://poj.org/problem?id=1797 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 buil…
题目传送门 题意:求1到n的最大载重量 分析:那么就是最大路上的最小的边权值,改变优先规则. #include <cstdio> #include <algorithm> #include <cstring> #include <queue> using namespace std; typedef long long ll; const int N = 1e3 + 10; const int E = 1e5 + 10; const int INF = 0x…
http://poj.org/problem?id=1797 题意 :给出N个城市M条边,每条边都有容量值,求一条运输路线使城市1到N的运输量最大. 思路 :用dijkstra对松弛条件进行变形.解释一下样例吧:从1运到3有两种方案方案1:1-2-3,其中1-2承重为3,2-3承重为5,则可以运送货物的最大重量是3(当大于3时明显1到不了2)方案2:1-3,可知1-3承重为4,故此路可运送货物的最大重量是4,故答案输出4 #include <iostream> #include <std…
Description 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 t…
Description 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 t…
题意:给你所有道路的载重,找出从1走到n的所有路径中载重最大的,即路径最小值的最大值. 思路:和之前的POJ3268很像.我们用Dijkstra,在每次查找时,我们把最大的先拿出来,因为最大的不影响最小值,然后我们更新的时候,如果当前承重比我们新开辟的路的承重的能力差,那就替换成新的. 注意题目所给数据有重边. 代码: #include<cstdio> #include<set> #include<cmath> #include<stack> #includ…
题意 : 找出 1 到 N 点的所有路径当中拥有最大承载量的一条路,输出这个最大承载量!而每一条路的最大承载量由拥有最大承载量的那一条边决定 分析 : 与 POJ 2253 相似且求的东西正好相反,属于求从一个指定起点到终点的所有路径当中拥有最大or最小的边是什么.只要改变一下 Dijkstra 中 DP 的意义 ==> Dis[i] 表示起点到 i 点的所有路径当中拥有最大or最小的边的权值.当然也可以使用最小生成树做法,但是这里的边应该是从大排到小,其他的都和 POJ 2253 一模一样了!…
题目 改动见下,请自行画图理解 具体细节也请看下面的代码: 这个花了300多ms #define _CRT_SECURE_NO_WARNINGS #include<string.h> #include<stdio.h> #include<math.h> #include<algorithm> using namespace std; ; #define typec int ;//防止后面溢出,这个不能太大 bool vis[MAXN]; typec cost…
求每条道路的最大承载量 和上一道题差不多 就是松弛的规则从最大值变成了最小值 /* *********************************************** Author :Sun Yuefeng Created Time :2016/10/22 20:09:36 File Name :A.cpp ************************************************ */ #include<cstdio> #include<iostrea…
思路:d(i)表示到达节点i的最大能运输的重量,转移方程d(i) = min(d(u), limit(u, i));注意优先队列应该以重量降序排序来重载小于符号. AC代码 #include <cstdio> #include <cmath> #include <cctype> #include <algorithm> #include <cstring> #include <utility> #include <string&…
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…
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…
题意: 求1到n路径上最大的最小值. 原因:样例输入 1 3 3 1 2 3 1 3 4 2 3 5 1-2最多可以运输3,2-3可最多以运输5,但是2的来源只有3,所以路径1-2-3上能运输的量为3 1-3可以运输4,所以结果就是4. 可以很明显的看出一条路径上能够运输的最大值与该路径上最小的边相等,所以只需求出最大的最小值即可. 最大生成树一定是一棵瓶颈树,由瓶颈树的性质可知,最小边一定最大. 按权值从大到小排序,跑一遍Kruskal求最大生成树记录最小值,当1与n联通时,即利用并查集判断f…
题目链接: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…