ACM - 最短路径
LP_Cong
Python, Qt C++ Developer ACMer https://github.com/Linzecong
展开
-
POJ - 1797 Heavy Transportation(最短路变形,SPFA,Dijkstra)
解题思路:最短路变形题,求两点之间经过的路的最大值。普通的最短路是求最短的路径的和,因此只要把求和改成求最大即可。详细见代码!原创 2017-07-26 11:23:31 · 515 阅读 · 0 评论 -
POJ - 2387 Til the Cows Come Home(Dijkstra SPFA 邻接矩阵 邻接表)
最短路的模板题,以这题为例子,介绍各种最短路算法,和图的各种表示。这里介绍了经典Dijkstra算法和,队列优化的Bell算法,即Spfa算法。Dijkstra算法不能解决负环,而Spfa可以,本例中,spfa返回1代表有负环,0代表没有。算法具体解释参考其他博文原创 2017-07-25 10:31:44 · 584 阅读 · 0 评论 -
POJ - 2449 Remmarguts' Date
Remmarguts' DateDescription"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. "Pri原创 2017-07-09 17:53:52 · 323 阅读 · 0 评论 -
HDU - 6181 Two Paths(真 · 求次短路径)
Two PathsProblem DescriptionYou are given a undirected graph with n nodes (numbered from 1 to n) and m edges. Alice and Bob are now trying to play a game. Both of them will take different原创 2017-08-24 22:58:57 · 948 阅读 · 0 评论 -
2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 H. Skiing
题意:有向图求最长路解题思路:DP求最长路,用到了Floyd的思想,把每一点的最长路都求一遍,记录最大即可#include#include#include#include#include#include#include#include#include#include#include#原创 2017-09-09 21:01:42 · 430 阅读 · 0 评论 -
GYM - 100812G Short Path (SPFA+思维)
Short Pathtime limit per test2.0 smemory limit per test256 MBinputstandard inputoutputstandard outputIn my opinion, people are divided into two categories: some原创 2017-12-02 19:37:07 · 310 阅读 · 0 评论 -
HDU - 6252 Subway Chasing (2017 CCPC FInal)(差分约束)
Subway ChasingTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 786 Accepted Submission(s): 258Special Judge Problem DescriptionMr. Pan...原创 2018-10-11 20:04:27 · 374 阅读 · 5 评论 -
牛客国庆集训派对Day6 J-最短路 (任意两点间最短路径问题)
链接:https://www.nowcoder.com/acm/contest/206/J来源:牛客网 题目描述给一个连通图,每次询问两点间最短路。每条边的长度都是1。输入描述:第一行两个整数n和m,表示图的点数和边数(1≤ n≤ 100000, 1≤ m≤ n+100)。接下来m行每行两个整数a和b,表示一条边(1≤ a, b≤ n)。保证没有自环和重边。保证图连通。接...原创 2018-10-06 19:55:18 · 1048 阅读 · 0 评论