随笔分类 - 图论---最短路
摘要:题目:https://www.luogu.org/problemnew/show/P1346 题意:n个路口,每个路口有好几条轨道,默认指向给出的第一个路口。 如果要换到另外的轨道去需要按一次开关。问从a到b最少需要几次开关。 思路:可以把默认的路口的轨道权值设为0,其他的权值都是1,不通的权值都是
阅读全文
摘要:题目:https://www.luogu.org/problemnew/show/P1144 题意:问1到各个节点的最短路有多少条。 思路:如果松弛的时候发现是相等的,说明可以经过该点的最短路径到达当前点,也就是说最短路径变多了。
阅读全文
摘要:题目:https://www.luogu.org/problemnew/show/P1339 题意:给定一张图,问起点到终点的最短路。 思路:dijkstra板子题。 很久没有写最短路了。总结一下dijkstra的步骤吧。 d数组用于表示当前最短路径,vis数组用于标记当前点是否已经在最短路集合中了
阅读全文
摘要:题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805358663417856 题意: 给定一个图,每天边上有时间和路程信息。要求找到路程最短且时间最短的路径,和时间最短经过的节点最少的路径。 思路: 和昨天写的那个P
阅读全文
摘要:题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805489282433024 题意: 给定一个图,一个目的地和每个节点上的自行车数量。 现在要找到从0到目的地的一条最短路,并且对这条路径上的点的自行车数目进行调度使得
阅读全文
摘要:Cow Relays Time Limit: 1000MS Memory Limit: 65536K Total Submissions:9207 Accepted: 3604 Description For their physical fitness program, N (2 ≤ N ≤ 1,
阅读全文
摘要:Sightseeing trip Time Limit: 1000MS Memory Limit: 65536K Total Submissions:8588 Accepted:3224 Special Judge Description There is a travel agency in Ad
阅读全文
摘要:Sorting It All Out Time Limit: 1000MS Memory Limit: 10000K Total Submissions:39731 Accepted: 13975 Description An ascending sorted sequence of distinc
阅读全文
摘要:2200: [Usaco2011 Jan]道路和航线 Description Farmer John正在一个新的销售区域对他的牛奶销售方案进行调查。他想把牛奶送到T个城镇 (1 <= T <= 25,000),编号为1T。这些城镇之间通过R条道路 (1 <= R <= 50,000,编号为1到R)
阅读全文
摘要:6101 最优贸易 0x60「图论」例题 描述 C国有 n 个大城市和 m 条道路,每条道路连接这 n 个城市中的某两个城市。任意两个城市之间最多只有一条道路直接相连。这 m 条道路中有一部分为单向通行的道路,一部分为双向通行的道路,双向通行的道路在统计条数时也计为1条。C国幅员辽阔,各地的资源分布
阅读全文
摘要:http://poj.org/problem?id=3662 Telephone Lines Time Limit: 1000MS Memory Limit: 65536K Total Submissions:9310 Accepted: 3374 Description Farmer John w
阅读全文
摘要:1076A Minimizing the String【字符串】 http://codeforces.com/contest/1076/problem/A 题意: 删掉字符串中的一个字符使得得到的字符串是字典序最小的一种。 思路: 从头到尾找到第一个字符他比他后面的一个字典序要大,那就是要删掉的。
阅读全文
摘要:One day in the jail, F·F invites Jolyne Kujo (JOJO in brief) to play tennis with her. However, Pucci the father somehow knows it and wants to stop her
阅读全文
摘要:Age of MoyuTime Limit: 5000/2500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 3125 Accepted ...
阅读全文
摘要:During the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of flymouse’s class a large bag of
阅读全文
摘要:While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a ...
阅读全文
摘要:N (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code better th...
阅读全文
摘要:Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and ...
阅读全文
摘要: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 ≤...
阅读全文
摘要:Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man w...
阅读全文