最短路
文章平均质量分 64
swqeaaa
有问题可以吻我
展开
-
POJ 2387 Til the Cows Come Home
Til the Cows Come HomeTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 71042 Accepted: 23730 DescriptionBessie is out in the field and wants to get back to the barn t...原创 2018-08-06 15:16:43 · 70 阅读 · 0 评论 -
POJ 1661 Help Jimmy 最短路
http://poj.org/problem?id=1661题意:一个人从(x,y)开始往下跳, 最高一次往下跳max, 中间有n个板子, 板子有左右端点位置和高度, 问最短多远到地面上.思路:考虑最短路起点0, 每个板子左右端点共2*n个点, 地面设为2*n+1建边:起点能到的有两种情况: 1 第一个板子的左端点和右端点 ...原创 2019-04-28 21:24:08 · 87 阅读 · 0 评论 -
【思维题】【最短路】【二分】SCU 4527 NightMare2
【题目】http://acm.scu.edu.cn/soj/problem.action?id=4527【题意】从1点走到n点,有m条边,每个边有最大的宝藏通行量和通过需要的时间。问在能否在炸弹爆炸前到达n点,若能,求此时最多能带多少宝藏?【思路】二分能带的宝藏量,宝藏通行量小于带的宝藏量的路就不能走了,用迪杰斯特拉求最快到n点的时间,如果小于等于炸弹爆炸的时间,那么就存下这个值,再多带点...原创 2018-08-08 21:14:12 · 150 阅读 · 0 评论 -
【最短路】【模板】Bellman-Ford 队列优化/spfa
/*Bellman-Ford*/#include<cstdio>#include<cstring>#include<queue>using namespace std;const int M=500005;const int INF=2000000000;class node{public: int v,next,w;} edge...原创 2018-08-03 08:40:05 · 208 阅读 · 0 评论 -
【最短路】【模板】Dijstra 优先队列优化
#include<cstdio>#include<queue>#include<cstring>#include<iostream>using namespace std;typedef long long ll;const ll INF=10000000000;const int M=1000020;class Edge{pu...原创 2018-08-03 08:39:44 · 161 阅读 · 0 评论 -
最短路径_Floyd算法
// ConsoleApplication1.cpp: 定义控制台应用程序的入口点。///*6 90 1 340 5 190 2 462 5 252 3 175 3 255 4 263 4 381 4 12*//*5 70 1 101 2 503 2 202 4 103 4 600 3 300 4 100*/#include "stdafx.h"...原创 2018-06-27 08:20:19 · 228 阅读 · 0 评论 -
POJ 3159 Candies(差分规划+Dijstra)
【题目】http://poj.org/problem?id=3159【参考】https://www.cnblogs.com/kuangbin/archive/2012/08/17/2644685.html(bin神~)【解题思路】 这是一题典型的差分约束题。不妨将糖果数当作距离,把相差的最大糖果数看成有向边AB的权值, 我们得到 dis[B]-dis[A]<=w(A,B)。看到这里,...原创 2018-07-31 00:15:56 · 125 阅读 · 0 评论 -
POJ 1502 MPI Maelstrom
【题目】http://poj.org/problem?id=1502【参考】https://blog.csdn.net/llx523113241/article/details/47068239【题目大意】有n台机器,两两之间的数据传输速度是一样的。现在给出一张下三角形,表示机器两两之间的传输时间,x表示两机器间无法传输数据,求一号机器传输数据到其他机器的最小时间。【重点】Dijstr...原创 2018-07-31 00:10:08 · 117 阅读 · 0 评论 -
POJ 1511 HDU 1535 Invitation Cards 【正常的邻接表使用】
http://poj.org/problem?id=1511 http://acm.hdu.edu.cn/showproblem.php?pid=1535Invitation CardsTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s...原创 2018-07-31 00:10:01 · 109 阅读 · 0 评论 -
poj3463(次短路)
Tour operator Your Personal Holiday organises guided bus trips across the Benelux. Every day the bus moves from one city S to another city F. On this way, the tourists in the bus can see the sights al...原创 2018-08-03 08:41:04 · 133 阅读 · 0 评论 -
POJ2499:Remmarguts' Date 第K短路 A*
"Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly touching his little ducks' head, he told them a story. "Prince Remmarguts lives in his kingdom UDF – ...原创 2018-08-08 21:38:17 · 121 阅读 · 0 评论 -
poj 3013 Big Christmas Tree
Christmas is coming to KCM city. Suby the loyal civilian in KCM city is preparing a big neat Christmas tree. The simple structure of the tree is shown in right picture.The tree can be represented as...原创 2018-08-11 23:50:30 · 75 阅读 · 0 评论 -
hdu 1217 Arbitrage
Arbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar buys 0.5 Britis...原创 2018-08-08 21:38:09 · 141 阅读 · 0 评论 -
POJ 3660 Cow Contest
N (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code better than others. Each cow has a certain constant skill rating that is un...原创 2018-08-08 21:38:05 · 67 阅读 · 0 评论 -
POJ 3268 Silver Cow Party
One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M≤ 100,000) unidirectional (one-way roa...原创 2018-08-08 21:37:51 · 88 阅读 · 0 评论 -
poj 1797 Heavy transportation
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 cus...原创 2018-08-06 15:16:54 · 84 阅读 · 0 评论 -
poj 2253 Frogger
Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of tourists' sun...原创 2018-08-06 15:16:49 · 74 阅读 · 0 评论 -
HDU 6582 Path BZOJ 1266 上学路线route 网络流 最短路
给出一个图, 问从起点到终点, 问去掉一些边使得最短路增大, 求最少的花费是多少(6582是边长, 1266是给定的).另外, 6582是有向边, 1266是无向边.这个题可以分解成两部分:Ⅰ求出最短路所有路径上的边Ⅱ在Ⅰ上新建一个图, 跑网络流最小割.最小割: 就是把起点和汇点割开的最小花费.这样, 就是花费最少的代价, 把所有的最短路径割断, 进而增大了最短路.Ⅰ就...原创 2019-07-25 23:37:04 · 146 阅读 · 0 评论