One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M ≤ 100,000) unidirectional (one-way roads connects pairs of farms; road i requires Ti (1 ≤ Ti ≤ 100) units of time to traverse.

Each cow must walk to the party and, when the party is over, return to her farm. Each cow is lazy and thus picks an optimal route with the shortest time. A cow's return route might be different from her original route to the party since roads are one-way.

Of all the cows, what is the longest amount of time a cow must spend walking to the party and back?

Input

Line 1: Three space-separated integers, respectively:  NM, and  X 
Line

Silver Cow Party POJ - 3268相关推荐

  1. D - Silver Cow Party POJ - 3268

    D - Silver Cow Party POJ - 3268 dijkstra 是 O(n2),堆优化一下, O(nlogn) 对每个点跑一次 dj, 取 max(dis(x->i)+dis( ...

  2. Silver Cow Party POJ - 3268(正反建图+dijkstra)

    One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1-N is going to attend the big cow ...

  3. Silver Cow Party POJ - 3268(dijkstra+反向交换)

    题意: 求X到某点来回路程的最短路的最大值. 模板更新中... 题目 One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered ...

  4. Silver Cow Party POJ - 3268 (固定起点和固定终点的最短路)

    思路:有向图.假设在X牧场参加party,从X回家的时候,以X为起点,使用一次Dijkstra算法即可.难点在于去X参加party的最短路如何求解. 这时候我们可以反向建图,即把原来有向图的方向全部反 ...

  5. POJ 3268 Silver Cow Party (最短路径)

    POJ 3268 Silver Cow Party (最短路径) Description One cow from each of N farms (1 ≤ N ≤ 1000) convenientl ...

  6. Silver Cow Party (POJ - 3268 )

    Silver Cow Party (POJ - 3268 ) 这道题是我做的最短路专题里的一道题,但我还没做这个,结果比赛就出了,真是.......... 题目: One cow from each ...

  7. [POJ](3268)Silver Cow Party ---最短路径(图)

    Silver Cow Party Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 23762   Accepted: 1085 ...

  8. POJ 3268:Silver Cow Party 求单点的来回最短路径

    Silver Cow Party Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 15989   Accepted: 7303 ...

  9. H - Cow Contest POJ - 3660(Floyd 传递闭包)

    H - Cow Contest POJ - 3660 题意: 有 n 头牛比赛,边 1 -> 2 代表 1 能赢 2 ,给你 m 条边,问能确定出多少头牛的名次? 思路: 如果 1->2 ...

最新文章

  1. 微软python在线学习_微软再推免费在线 Python 教程,面向数据科学和机器学习初学者...
  2. SqlServer int型转varchar型 出现*号
  3. 单例模式 之 单例模式——饿汉模式
  4. Using mongoDB's Profiler analyze the performance of database operations
  5. Linux服务器rsync自动备份
  6. 关于程序中查询效率的问题
  7. aes模式_AES的完整形式是什么?
  8. 常用类中的方法 —— java.lang.String
  9. 电平转换电路_RS232电平和TTL电平有什么不同?如何转换?
  10. php Tsocket read 0,thrift 返回 TSocket read 0 bytes 求助!!!!汗血宝马
  11. iphone three20 保存本地的图片
  12. 顺藤摸瓜的解决GDB的DEBUG中出现的小问题
  13. 知识图谱特征学习算法
  14. SingleSignOn的配置和说明
  15. Linux服务简单优化
  16. 21_08_17王道计算机考研 数据结构(二)
  17. VBA代码片之计算加权平均分
  18. Untracked Files Prevent Checkout
  19. react中使用微信jssdk分享总结
  20. 一文看懂单片机排阻的作用!

热门文章

  1. Windows 7安装以及VS2008和Office2007冲突的问题
  2. 如何去除移动磁盘写保护?
  3. 前端jQuery表单验证
  4. 21 个好用的持续集成工具
  5. VIM 搜索时的大小写敏感
  6. strace工具简介
  7. 另类数据Alternative Data行业调查
  8. 玩什么别玩优化!WINXP优化精髓!! (很值得学习)
  9. PCB设计容易出错的地方都有哪些?
  10. java文件转换成byte数组以及byte数组上传到文件