codeforce 602C The Two Routes
来源:互联网 发布:找网络推手联系方式 编辑:程序博客网 时间:2024/04/29 02:37
原题地址
题意
一个城市有N个小镇,部分小镇之间有铁路相连,当且仅当两个小镇之间没有铁路相连时,会有公路相连。
两个人同时从编号1的小镇前往编号N的小镇,分别坐火车和坐汽车,火车和汽车每经过一条边都花费一小时,要求两个人不可以同时到达除了N之外的小镇,最小化两个人中后到达的那人花费的时间
题解
乍一想这个“要求两个人不可以同时到达除了N之外的小镇”非常之难处理,以为是DPbalabala的
然后搜了发题解
因为两点之间要么铁路相连,要么公路相连,所以1-N一定直接连通,对应地那个人花费一小时到达,不经过任意中间顶点……
问题变成了最短路,N很小,可以floyd解决,当然也可以dijkstra
代码我都不想上了,写的dijkstra但是很丑……
0 0
- codeforce 602C The Two Routes
- Codeforce 601A The Two Routes
- 【50.00%】【codeforces 602C】The Two Routes
- CodeForces 602C The Two Routes(最短路)
- Codeforces 602C The Two Routes【最短路+思维】
- The Two Routes CodeForces
- Codeforces Round #333 (Div. 2) 602C The Two Routes 最短路
- CF Round#333 Div2 C. The Two Routes
- Codeforces Round #333 (Div. 2) C. The Two Routes
- Codeforces Round #333 (Div. 2) C. The Two Routes
- Codeforces Round #333 (Div. 2) C. The Two Routes
- two bishops on the chessboard (CodeForce 463C)
- CodeForces 602C__The Two Routes
- codeforces 601A The Two Routes
- Codeforces Round #333 The Two Routes
- Codeforces 601A The Two Routes
- CodeForces - 601A The Two Routes
- Round 6 The Two Routes CodeForces
- c++作业3
- VMware虚拟机网络详解(包括多网卡)
- Redis数据淘汰策略
- supervisor 笔记
- javascript杂谈 半整合半原创篇
- codeforce 602C The Two Routes
- Spring中ApplicationContext加载机制和配置初始化
- LeetCode 191. Number of 1 Bits
- C#线程本地存储:LocalDataStoreSlot和ThreadLocal<T>
- 关于Android中Activity之间socket传递的问题
- c++作业3
- Hibernate多对一的双向关联xml配置
- Ubuntu环境下配置ElasticSearch
- NodeJs安装package.json中依赖包失败