BZOJ 2100: [Usaco2010 Dec]Apple Delivery( 最短路 )
跑两遍最短路就好了..
话说这翻译2333
----------------------------------------------------------------------
----------------------------------------------------------------------
2100: [Usaco2010 Dec]Apple Delivery
Time Limit: 10 Sec Memory Limit: 64 MB
Submit: 479 Solved: 169
[Submit][Status][Discuss]
Description
Bessie has two crisp red apples to deliver to two of her friends in the herd. Of course, she travels the C (1 <= C <= 200,000) cowpaths which are arranged as the usual graph which connects P (1 <= P <= 100,000) pastures conveniently numbered from 1..P: no cowpath leads from a pasture to itself, cowpaths are bidirectional, each cowpath has an associated distance, and, best of all, it is always possible to get from any pasture to any other pasture. Each cowpath connects two differing pastures P1_i (1 <= P1_i <= P) and P2_i (1 <= P2_i <= P) with a distance between them of D_i. The sum of all the distances D_i does not exceed 2,000,000,000. What is the minimum total distance Bessie must travel to deliver both apples by starting at pasture PB (1 <= PB <= P) and visiting pastures PA1 (1 <= PA1 <= P) and PA2 (1 <= PA2 <= P) in any order. All three of these pastures are distinct, of course. Consider this map of bracketed pasture numbers and cowpaths with distances: If Bessie starts at pasture [5] and delivers apples to pastures [1] and [4], her best path is: 5 -> 6-> 7 -> 4* -> 3 -> 2 -> 1* with a total distance of 12.
CLJ要从Pb点(家)出发,既要去Pa1点NOI赛场拿金牌,也要去Pa2点CMO赛场拿金牌。(途中不必回家)
可以先去NOI,也可以先去CMO。
当然神犇CLJ肯定会使总路程最小,输出最小值。
Input
* Line 1: Line 1 contains five space-separated integers: C, P, PB, PA1, and PA2 * Lines 2..C+1: Line i+1 describes cowpath i by naming two pastures it connects and the distance between them: P1_i, P2_i, D_i
Output
* Line 1: The shortest distance Bessie must travel to deliver both apples
Sample Input
5 1 7
6 7 2
4 7 2
5 6 1
5 2 4
4 3 2
1 2 3
3 2 2
2 6 3
Sample Output
HINT
求翻译.........站内PM我吧.........
Source
BZOJ 2100: [Usaco2010 Dec]Apple Delivery( 最短路 )的更多相关文章
- BZOJ 2100: [Usaco2010 Dec]Apple Delivery spfa
由于是无向图,所以可以枚举两个终点,跑两次最短路来更新答案. #include <queue> #include <cstdio> #include <cstring&g ...
- bzoj 2100: [Usaco2010 Dec]Apple Delivery【spfa】
洛谷数据好强啊,普通spfa开o2都过不了,要加双端队列优化 因为是双向边,所以dis(u,v)=dis(v,u),所以分别以pa1和pa2为起点spfa一遍,表示pb-->pa1-->p ...
- 【BZOJ】2100: [Usaco2010 Dec]Apple Delivery(spfa+优化)
http://www.lydsy.com/JudgeOnline/problem.php?id=2100 这题我要吐血啊 我交了不下10次tle.. 噗 果然是写挫了. 一开始没加spfa优化果断t ...
- 【bzoj2100】[Usaco2010 Dec]Apple Delivery 最短路
题目描述 Bessie has two crisp red apples to deliver to two of her friends in the herd. Of course, she tr ...
- bzoj2100 [Usaco2010 Dec]Apple Delivery
Description Bessie has two crisp red apples to deliver to two of her friends in the herd. Of course, ...
- bzoj2100 [Usaco2010 DEC]Apple Delivery苹果贸易
题目描述 一张P个点的无向图,C条正权路.CLJ要从Pb点(家)出发,既要去Pa1点NOI赛场拿金牌,也要去Pa2点CMO赛场拿金牌.(途中不必回家)可以先去NOI,也可以先去CMO.当然神犇CLJ肯 ...
- BZOJ 2101: [Usaco2010 Dec]Treasure Chest 藏宝箱( dp )
dp( l , r ) = sum( l , r ) - min( dp( l + 1 , r ) , dp( l , r - 1 ) ) 被卡空间....我们可以发现 l > r 是无意义的 ...
- BZOJ 2015: [Usaco2010 Feb]Chocolate Giving( 最短路 )
裸最短路.. ------------------------------------------------------------------------------------ #include ...
- BZOJ 2101 [Usaco2010 Dec]Treasure Chest 藏宝箱:区间dp 博弈【两种表示方法】【压维】
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=2101 题意: 共有n枚金币,第i枚金币的价值是w[i]. 把金币排成一条直线,Bessie ...
随机推荐
- .net中不能在DropDownList中选中多个项的解决方法
页面中放有多个DropDownList,点击修改时候,需要根据值来设置两个DropDownList的选中项,当值为空时则需要选中默认值. 页面报错:不能在DropDownList中选中多个项. 直接粘 ...
- rsyslog 日志归类思路--根据syslog local5 nginx-zjzc01;
Aug 5 16:36:12 jrhwpt01 nginx-zjzc01: www.zjcap.cn 10.252.105.157 10.171.246.184 [05/Aug/2016:16:36: ...
- 宣布正式发布 Windows Azure Notification Hub,新增 SQL Server AlwaysOn 可用性组侦听器支持
今天,我们非常高兴地宣布,针对使用 Windows Azure 的移动和企业开发人员推出一些新功能.这些新功能可以减少构建移动应用程序的开发时间和成本,并能帮助企业开发人员实现高可用性和全球业务连续性 ...
- 一、Cocos2dx在visualStudio或者vc++中环境搭建(入门篇)
本文由qinning199原创,转载请注明:http://www.cocos2dx.net/?p=106 0.概述 Cocos2dx-win32的项目能够被向导生成 向导支持vs2008,vs2010 ...
- #pragma的用法
在所有的预处理指令中,#Pragma 指令可能是最复杂的了,它的作用是设定编译器的状态或者是指示编译器完成一些特定的动作.#pragma指令对每个编译器给出了一个方法,在保持与C和 C++语言完全 ...
- Mybaits入门之起航
前言 Mybaits技术现在很多公司都在使用,它提供了简单的API可以快速进行数据库操作,所以不管是自己做系统还是找工作都有必要了解一下. 学习一门技术如果是入门的话要么买书要么就是阅读官方的文档,而 ...
- 深入理解 IE haslayout
转载自Bubblings Blog 原文地址:http://riny.net/2013/haslayout/ 1.什么是haslayout layout是windows IE的一个私有概念,它决定了元 ...
- js获取智能机浏览器版本信息
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> ...
- 【原创】ASP.NET Web开发,实现打印Log日志,步骤详解
添加Log需要四步: 一.引用log4net.dll,详见附件:http://pan.baidu.com/s/1c0hab2g 二.项目根目录下,添加 log4net.xml <?xml ver ...
- JavaWeb学习过程 之c3p0的使用
这几天在学习使用MVC模式来做几个小项目,在学习的过程中,用到了数据库连接池.便特意去学习了一下. 一.谈一谈为什么要使用数据库连接池 在开发基于数据库的web程序时,传统的模式(在servlet,b ...