题目链接:http://poj.org/problem?id=3635 题意题解等均参考:POJ 3635 - Full Tank? - [最短路变形][优先队列优化Dijkstra]. 一些口胡: 说实话,上次写类似的二维状态最短路Gym 101873C - Joyride - [最短路变形][优先队列优化Dijkstra],我没能把手写二叉堆优化Dijkstra的给写出来. 这次费了点功夫,也算是给写出来了,需要注意的点还是有点多的.而且我终于深刻理解为啥不推荐手写二叉堆了,主要是代码量相比…
题目链接:http://poj.org/problem?id=3635 Description After going through the receipts from your car trip through Europe this summer, you realised that the gas prices varied between the cities you visited. Maybe you could have saved some money if you were…
任意门:http://poj.org/problem?id=3635 Full Tank? Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8388   Accepted: 2734 Description After going through the receipts from your car trip through Europe this summer, you realised that the gas pri…
After going through the receipts from your car trip through Europe this summer, you realised that the gas prices varied between the cities you visited. Maybe you could have saved some money if you were a bit more clever about where you filled your fu…
链接: http://poj.org/problem?id=2253 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22010#problem/D Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 21206   Accepted: 6903 Description Freddy Frog is sitting on a stone in the…
Full Tank? Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5857   Accepted: 1920 Description After going through the receipts from your car trip through Europe this summer, you realised that the gas prices varied between the cities you v…
题意: 已知每一个点的加油站的油价单位价格(即点权).每条路的长度(边权). 有q个询问.每一个询问包含起点s.终点e和油箱容量. 问从起点走到终点的最小花费.假设不可达输出impossible,否则输出最小的旅途费用. 算法: 事实上要分析状态= =感觉就像是dp. 最直接的想法是  每到一个点都加上要走到下一个点所须要的油量.可是走的路不同,究竟怎么处理加多少的问题呢? 因此想到分解状态.即拆点.每到一个点都+1单位的油量,然后把这个状态增加队列.另外假设如今油箱内的油足够达到下一点, 则更…
题目:click here 题意: 有n个城市,m条道路,在每条道路上有一个承载量,现在要求从1到n城市最大承载量,而最大承载量就是从城市1到城市n所有通路上的最大承载量.分析: 其实这个求最大边可以近似于求最短路,只要修改下找最短路更新的条件就可以了. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #i…
题目 Description 已知每个点的加油站的油价单价(即点权),每条路的长度(边权). 有q个询问,每个询问包括起点s.终点e和油箱容量c. 问从起点走到终点的最小花费.如果不可达输出impossible,否则输出最小的旅途费用. Solution 第一想法想到拆点,每个点拆成 0~c 那么多个点,妥妥TLE. 后来看题解想到可以进行一个最短路DP,用一个三元组 (x,y,z) 表示当前在点 x,花了 y 元,油量为 z,把这个压进优先队列,每次取出堆中 y 最少的点进行更新即可. 这里还…
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 rea…