随笔分类 - 01.图论 - (3)最短路
摘要:题目链接:https://zhixincode.com/contest/3/problem/F?problem_id=39 样例输入 1 样例输出 1 6 样例输出 1 题解: 这个体力感觉跟势能是个差不多的东西……很显然,如果没有降低山峰的能力,wls最多只能爬高度为 h[1]+k 的山,更高
阅读全文
摘要:题目链接:http://poj.org/problem?id=3635 题意题解等均参考:POJ 3635 - Full Tank? - [最短路变形][优先队列优化Dijkstra]。 一些口胡: 说实话,上次写类似的二维状态最短路Gym 101873C - Joyride - [最短路变形][优
阅读全文
摘要:题目链接:http://poj.org/problem?id=3635 Description After going through the receipts from your car trip through Europe this summer, you realised that the
阅读全文
摘要:题目链接:http://codeforces.com/gym/101873/problem/C 题意: 这是七月的又一个阳光灿烂的日子,你决定和你的小女儿一起度过快乐的一天。因为她真的很喜欢隔壁镇上的仙女公园,所以你决定到那儿去玩一天。 你妻子同意开车送你去公园接你。她非常准时,所以她确切地告诉你她
阅读全文
摘要:题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=1003 Time Limit: 10 Sec Memory Limit: 162 MB Description 物流公司要把一批货物从码头A运到码头B。由于货物量比较大,需要n天才能运完。货
阅读全文
摘要:题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=1001 Description现在小朋友们最喜欢的"喜羊羊与灰太狼",话说灰太狼抓羊不到,但抓兔子还是比较在行的,而且现在的兔子还比较笨,它们只有两个窝,现在你做为狼王,面对下面这样一个网格
阅读全文
摘要:题目链接:https://nanti.jisuanke.com/t/31001 题意: 一带权有向图,有 n 个节点编号1~n,m条有向边,现在一人从节点 1 出发,他有最多 k 次机会施展魔法使得某一条边的权变成 0,问他走到节点 n 的最小权值为多少。 题解: 将dist数组和vis数组都扩展一
阅读全文
摘要:目录: 从一道题目出发 —— Luogu 4779 - 【模板】单源最短路径(标准版) Bellman-Ford算法 SPFA算法 SLF+swap优化的SPFA(但它还是死了) Dijkstra算法 优先队列优化Dijkstra算法 手写二叉堆优化Dijkstra算法 线段树优化Dijkstra算
阅读全文
摘要:题目链接:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1808 Time limit: 5000 ms Memory limit: 131072 kB Bobo 居住在大城市 ICPCCamp。 ICPCCamp 有 n 个地铁站,用 1,2
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2544 Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Descripti
阅读全文
摘要:题目链接:http://poj.org/problem?id=1556 Time Limit: 1000MS Memory Limit: 10000K Description You are to find the length of the shortest path through a cham
阅读全文
摘要:人老了就比较懒,故意挑了到看起来很和蔼的题目做,然后套个spfa和dinic的模板WA了5发,人老了,可能不适合这种刺激的竞技运动了…… 题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2760 Descriptio
阅读全文
摘要:看完题目就觉得是个图论题…… 每个人的成绩就是vertice,两个人的分数差就是edge,那么肯定类似于一种relax的方式,不断将每个人的成绩的min往上提, 当然,单纯的遍历一遍G.E肯定不可能就得到yaoge成绩min的最大值,所以直觉上就想到了bellman-ford,写了一发交了就过了 还
阅读全文
摘要:Time Limit: 15000/8000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description There are n Doge Planets in the Doge Space. The
阅读全文
摘要:Time Limit: 15000/8000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others) Input There are several test cases. Please process till EOF.For ea
阅读全文
摘要:Description Mike moved to a new city. There are bus stations in the city, each has a unique name. Each bus has its designated schedule, and sequential
阅读全文
摘要:题目翻译来自:http://poj.org/showmessage?message_id=97785 老老实实两次Dijkstra呗…… 两次都是从x点出发,第一次是按输入生成的正常的图,这样dijkstra后得到的是每头牛去参加宴会的最短时间, 第二次是将图上每条边都翻转一个方向后得到的图,这样d
阅读全文
摘要:Time Limit: 1000MS Memory Limit: 65536K Description Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is s
阅读全文
摘要:Time Limit: 1000MS Memory Limit: 65536K Description Arbitrage is the use of discrepancies in currency exchange rates to transform one unit of a curren
阅读全文