最短路
eazo
这个作者很懒,什么都没留下…
展开
-
战争 I(最短路+离线算法)
题目描述某年,白国和委国之间的战争爆发了!然而,在委国指挥官委兆的眼里,白国人不堪一击。现在他手上有一张白国的地图,发现白国有 n 个据点,m 条无向道路,他们有各自的长度。于是他决定按一定顺序破坏白国的一些据点,使得所有连接这些据点与其他据点的道路无法通行。同时,为了更有效率的攻城略地,也为了满足委兆的成就感,他有时还想知道当前某两个据点间的最短路径长。请编程满足他的要求。输入第一行两个正整数 n,m。接下来 m 行,每行有三个数 a,b,v表示一条连接 a,b的无向边。接下来一行一个正整数原创 2020-05-31 21:24:51 · 364 阅读 · 0 评论 -
走格子(bfs+dji)
题目描述CYJ想找到他的小伙伴FPJ,.CYJ和FPJ现在位于一个房间里,这个房间的布置可以看成一个N行M列的矩阵,矩阵内的每一个元素会是下列情况中的一种:1.障碍区域—这里有一堵墙(用‘#’表示).2.这是CYJ最开始在的区域(用‘C’表示).3.这是FPJ在的区域(用‘F’表示).4.空区域(用‘.’表示).CYJ携带了一个所谓传送枪的东西,这是一把可以创造传送门的枪械,在每一次行...原创 2020-04-19 21:56:47 · 506 阅读 · 0 评论 -
Coins Respawn(SPFA 最长路)
题目描述There is a directed graph with N vertices numbered 1 to N and M edges. The i-th edge is directed from Vertex Ai to Vertex Bi, and there are Ci coins placed along that edge. Additionally, there is...原创 2020-02-09 17:54:43 · 453 阅读 · 0 评论 -
重要人物(最短路)
题目描述某重要人物P要寻访城市C的G个地方,由于该人物非常重要,交警打算对人物P行走的街道进行临时封道(不准普通市民进入,但如果在封道前进入的可以继续行走,也可以正常出去)。当人物P进入这条街道之前和P走出这条街道之后,普通市民都可以正常进入该街道。比如,P在第10分钟期间进入街道X,并要X街道上行走5分钟,则在第10、11、12、13、14分钟期间,普通市民不可以进入X街道,市民可以在第9分...原创 2020-02-06 17:49:43 · 278 阅读 · 0 评论 -
Hopscotch Addict(分层图最短路)
题目描述Ken loves ken-ken-pa (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex ui to V...原创 2020-02-05 19:54:42 · 402 阅读 · 0 评论 -
飞行计划(最短路)
题目描述已知地图上一共有n个机场,Alice要从1号机场飞到n号机场。从i号机场飞行到j号机场需要消耗dist(i,j)个单位的油量,其中 dist(i,j)为i号机场和j号机场之间的欧几里得距离。Alice可以选择在任意机场起降和加油。飞机油箱最多可以保存u单位的燃油。考虑到可能遇到的极端天气,某些机场在某些时候不具备降落的条件。所以出于安全的考虑,当他飞到一个机场的时候,必须保证飞机剩...原创 2020-01-28 20:57:03 · 574 阅读 · 0 评论 -
赛艇表演(图论)
题目描述小明去某个地区观看赛艇比赛,这个地区共有n个城市和m条道路,每个城市都有赛艇比赛,在第i个城市观看赛艇表演的价钱为ai, 去其他城市观看也需要支付赛艇表演的价格。任意两个城市之间通过一条公路连接,并且道路是双向通行的, 观看赛艇比赛时经过的每一条道路都要支付一定的过路费,观看完比赛返回家时经过的每一条道路也要支付过路费。对于每个城市u,你需要为小明确定一个城市v,使得从u出发,前往v看...原创 2019-11-13 14:42:55 · 183 阅读 · 0 评论 -
跑路(倍增+floyd)
题目描述n+e的工作不仅繁琐,公司更有苛刻的规定,hzwer要求n+e每天早上在6:00之前到达公司发题目给小朋友做,否则这个月工资清零。可是n+e偏偏又有赖床的坏毛病。于是为了保住自己的工资,n+e买了一个十分牛B的空间跑路器,每秒钟可以跑2kkm(k∈N)。当然,这个机器是用int存的,所以总跑路长度不能超过2147483647km。n+e的家到hzwer公司的路可以看做一个有向图,n+...原创 2019-10-17 22:28:06 · 141 阅读 · 0 评论 -
transaction transaction transaction(树形DP SPFA最长路)
题目描述Kelukin is a businessman. Every day, he travels around cities to do some business. On August 17th, in memory of a great man, citizens will read a book named “the Man Who Changed China”. Of course...原创 2019-10-05 01:11:26 · 226 阅读 · 0 评论 -
MEETING(完全图建图 最短路)
题目描述Bessie and her friend Elsie decide to have a meeting. However, after Farmer John decorated his fences they were separated into different blocks. John’s farm are divided into n blocks. Bessie live...原创 2019-10-04 00:59:19 · 313 阅读 · 0 评论 -
Cow Relays(矩阵快速幂 + floyd)
题目描述For their physical fitness program, N (2 ≤ N ≤ 1,000,000) cows have decided to run a relay race using the T (2 ≤ T ≤ 100) cow trails throughout the pasture.Each trail connects two different inte...原创 2019-09-20 15:51:22 · 424 阅读 · 0 评论 -
Telephone Lines(最短路+二分)
题目描述Farmer John wants to set up a telephone line at his farm. Unfortunately, the phone company is uncooperative, so he needs to pay for some of the cables required to connect his farm to the phone sy...原创 2019-09-09 22:15:47 · 867 阅读 · 0 评论 -
free (多层图最短路)
题目描述Your are given an undirect connected graph.Every edge has a cost to pass.You should choose a path from S to T and you need to pay for all the edges in your path. However, you can choose at most k...原创 2019-08-23 20:30:35 · 266 阅读 · 0 评论 -
Joyride(分层图最短路)
题目描述It is another wonderful sunny day in July – and you decided to spend your day together with your little daughter Joy. Since she really likes the fairy-park in the next town, you decided to go the...原创 2019-08-19 10:25:11 · 356 阅读 · 0 评论 -
POJ 2253 Frogger (最短路,floyed)
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...原创 2019-01-17 21:14:47 · 105 阅读 · 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...原创 2019-01-17 23:13:07 · 234 阅读 · 0 评论