BNUOJ 19792 Airport Express】的更多相关文章

Airport Express Time Limit: 1000ms Memory Limit: 131072KB This problem will be judged on UVA. Original ID: 1137464-bit integer IO format: %lld      Java class name: Main   In a small city called Iokh, a train service, Airport-Express, takes residents…
Problem    UVA - 11374 - Airport Express Time Limit: 1000 mSec Problem Description In a small city called Iokh, a train service, Airport-Express, takes residents to the airport more quickly than other transports. There are two types of trains in Airp…
Description Problem D: Airport Express In a small city called Iokh, a train service, Airport-Express, takes residents to the airport more quickly than other transports. There are two types of trains in Airport-Express, the Economy-Xpress and the Comm…
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2369 Description Problem D: Airport Express In a small city called Iokh, a train service, Airport-Express, takes residents to the airport more quick…
In a small city called Iokh, a train service, Airport-Express, takes residents to the airport more quickly than other transports. There are two types of trains in Airport-Express, the Economy-Xpress and the Commercial-Xpress. They travel at different…
最短路问题. 从起点和终点开始各跑一次dijkstra,可以得到起点.终点到任意点的距离.枚举使用的商业线路,找最优解. 破题卡输出,记录前驱和输出什么的仿佛比算法本身还麻烦. /*by SilverN*/ #include<algorithm> #include<iostream> #include<cstring> #include<cstdio> #include<cmath> #include<vector> #include…
最短路. 把题目抽象一下:已知一张图,边上的权值表示长度.现在又有一些边,只能从其中选一条加入原图,使起点->终点的距离最小. 当加上一条边a->b,如果这条边更新了最短路,那么起点st->终点ed的最小距离=st->a  +  a->b  +b->ed 三个值的最短距离之和.于是正反求两次单元最短路.再将k条边遍历一遍就好了. 最近在改代码风格,写起来很别扭..uva又挂了,最让我不理解的是http://www.cnblogs.com/arbitrary/archiv…
题意: 给一幅图,要从s点要到e点,图中有两种无向边分别在两个集合中,第一个集合是可以无限次使用的,第二个集合中的边只能挑1条.问如何使距离最短?输出路径,用了第二个集合中的哪条边,最短距离. 思路: (1)简单易操作方法:既然第二个集合的边只能有1条,就穷举下这些边,可能的边集进行求最短路,同时记录3个答案.复杂度是O(m*k). (2)时间复杂度低:不妨先求从s到每个其他点的距离d1[i],再求e到其他每个点的距离d2[i],接下来穷举第二个集合中的每条边u-v,那么最短距离为d1[u]+d…
题意: 在Iokh市中,机场快线是市民从市内去机场的首选交通工具.机场快线分为经济线和商业线两种,线路,速度和价钱都不同.你有一张商业线车票,可以坐一站商业线,而其他时候只能乘坐经济线.假设换乘时间忽略不计,你的任务是找一条去机场最快的路线. 分析: 因为商业线只能走一次,我们就枚举走哪条商业线(或不走),用2次单源最短路分别求从起点和终点出发到所有路的最短路,最后比较即可. 这里我最短路打的是spfa. 代码如下:(注意输出格式) #include<cstdio> #include<c…
枚举每条商业线<a, b>,设d[i]为起始点到每点的最短路,g[i]为终点到每点的最短路,ans便是min{d[a] + t[a, b] + g[b]}.注意下判断是否需要经过商业线.输出也有点坑的,每两组间用空行隔开... #include<iostream> #include<algorithm> #include<vector> #include<string> #include<queue> #include<stac…