
spfa算法
xuanweiace
一个热爱算法竞赛的弱校ACMer路过。青大本,浙大硕,方向后端开发,菜鸡一枚,奋斗ing...
展开
-
【POJ-3259】 Wormholes(判负环,spfa算法)
题干: While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time t...原创 2018-07-31 20:09:12 · 460 阅读 · 0 评论 -
【POJ - 3037】Skiing (Dijkstra算法)
题干: Bessie and the rest of Farmer John's cows are taking a trip this winter to go skiing. One day Bessie finds herself at the top left corner of an R (1 <= R <= 100) by C (1 <= C <= 100) ...原创 2018-08-01 22:13:06 · 389 阅读 · 0 评论 -
*【POJ - 1860】Currency Exchange (单源最长路---Bellman_Ford算法判正环)
题干: Description Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these cur...原创 2018-08-02 15:33:20 · 608 阅读 · 0 评论 -
【POJ - 3169】 Layout(差分约束+spfa)(当板子记?)
题干: Like everyone else, cows like to stand close to their friends when queuing for feed. FJ has N (2 <= N <= 1,000) cows numbered 1..N standing along a straight line waiting for feed. The cows ...原创 2018-08-02 22:44:34 · 262 阅读 · 0 评论 -
【POJ - 3259 】Wormholes(Bellman_Ford或spfa算法,判断有向图中是否存在负环)
题干: 农夫约翰在探索他的许多农场,发现了一些惊人的虫洞。虫洞是很奇特的,因为它是一个单向通道,可让你进入虫洞的前达到目的地!他的N(1≤N≤500)个农场被编号为1..N,之间有M(1≤M≤2500)条路径,W(1≤W≤200)个虫洞。FJ作为一个狂热的时间旅行的爱好者,他要做到以下几点:开始在一个区域,通过一些路径和虫洞旅行,他要回到最开时出发的那个区域出发前的时间。也许他就能遇到自己了:)...原创 2018-08-28 22:28:32 · 649 阅读 · 0 评论 -
*【HDU - 6201】transaction transaction transaction(树形dp 或 spfa最长路 或 网络流)
题干: 题目大意: 给出一棵n个顶点的树,每个点有一个权值,代表商品的售价,树上每一条边上也有一个权值,代表从这条边经过所需要的花费。现在需要你在树上选择两个点,一个作为买入商品的点,一个作为卖出商品的点,当然需要考虑从买入点到卖出点经过边的花费。使得收益最大。允许买入点和卖出点重合,即收益最小值为0。题目虽然没说,但是默认就是只做一次买卖。 解题报告: 这题方法很多,最容易想到...原创 2019-03-27 14:56:35 · 271 阅读 · 0 评论 -
【2019icpc南京站网络赛 - H】Holy Grail(最短路,spfa判负环)
题干: As the current heir of a wizarding family with a long history,unfortunately, you find yourself forced to participate in the cruel Holy Grail War which has a reincarnation of sixty years.However,f...原创 2019-09-24 20:40:28 · 232 阅读 · 0 评论