最短路
nka_kun
ACMer
展开
-
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' sunscreen, he wants to avoid swimming and instead reach her原创 2017-08-30 21:32:15 · 206 阅读 · 0 评论 -
2018.7.30 最短路问题的几个代码详解
以HDU-2544为例:Floyd:#include<bits/stdc++.h>#define mem(a,b) memset(a,b,sizeof(a))#define mod 1000000007using namespace std;typedef long long ll;const int maxn = 2e5+5;const double eps =...原创 2018-07-30 11:23:31 · 765 阅读 · 4 评论 -
csu1808: 地铁(边看为点最短路)
Description Bobo 居住在大城市 ICPCCamp。ICPCCamp 有 n 个地铁站,用 1,2,…,n 编号。 m 段双向的地铁线路连接 n 个地铁站,其中第 i 段地铁属于 ci 号线,位于站 ai,bi 之间,往返均需要花费 ti 分钟(即从 ai 到 bi 需要 ti 分钟,从 bi 到 ai 也需要 ti 分钟)。众所周知,换乘线路很麻烦。如果乘坐第 i 段地铁来到地铁站...原创 2018-05-04 15:30:48 · 227 阅读 · 0 评论 -
SCU - 4444 Travel(补图最短路)
TravelThe country frog lives in has towns which are conveniently numbered by .Among pairs of towns, of them are connected by bidirectional highway, which needs minutes to travel. The other pairs are c...原创 2018-05-04 15:09:45 · 369 阅读 · 0 评论 -
HDU5876Sparse Graph(补图最短路,队列做法)
Sparse GraphProblem DescriptionIn graph theory, the complement of a graph G is a graph H on the same vertices such that two distinct vertices of H are adjacent if and only if they are notadjacent in G...原创 2018-05-04 14:59:24 · 142 阅读 · 0 评论 -
ZOJ2770Burn the Linked Camp(差分约束+SPFA)
Burn the Linked CampTime Limit: 2 Seconds Memory Limit: 65536 KBIt is well known that, in the period of The Three Empires, Liu Bei, the emperor of the Shu Empire, was defeated by Lu Xun, a genera...原创 2018-04-10 15:09:48 · 150 阅读 · 0 评论 -
POJ3255 Roadblocks(次短路问题)
RoadblocksTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 17736 Accepted: 6222DescriptionBessie has moved to a small farm and sometimes enjoys returning to visit one of her best friends. She...原创 2018-03-12 18:34:03 · 309 阅读 · 0 评论 -
Contest 073 joisino's travel(最短路Floyd+全排列)
There are N towns in the State of Atcoder, connected by M bidirectional roads.The i-th road connects Town Ai and Bi and has a length of Ci.Joisino is visiting R towns in the state, r1,r2,..,rR (not necessarily in this order).She will fly to the first原创 2017-09-10 18:34:43 · 318 阅读 · 0 评论 -
POj 1860 Currency Exchange(SPFA判负权)
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 currencies. There can be several points specializing in the same pair of curr原创 2017-08-31 13:34:56 · 300 阅读 · 0 评论 -
CodeForces - 1051F The Shortest Statement(最短路,lca)
题意:给出一个图,询问任意两点之间最短路,边比点多不过20.思路:因为边多的很少,所以可以看成一个树,又多加了几条边.这样其实我们可以把那几个点看成中转节点,这样我们可以求出那些点到任意点的最短路径,然后询问的时候,对于x,y,要不从树上直接从x,y这里用lca即可,要么经过其中一个节点,为什么不是结果其中几个节点呢?其实经过一个节点就够了,那个节点到任意节点的最短路我们是知道的,他如果需要会...原创 2018-09-24 10:00:43 · 324 阅读 · 0 评论