BZOJ 1631: [Usaco2007 Feb]Cow Party( 最短路 )
这道题和蔡大神出的今年STOI初中组的第二题几乎一模一样...
先跑一遍最短路 , 再把所有边反向 , 再跑一遍 , 所有点两次相加的最大值即为answer
-----------------------------------------------------------------------------
void init() {
-----------------------------------------------------------------------------
1631: [Usaco2007 Feb]Cow Party
Time Limit: 5 Sec Memory Limit: 64 MB
Submit: 524 Solved: 388
[Submit][Status][Discuss]
Description
Input
第1行:三个用空格隔开的整数.
第2行到第M+1行,每行三个用空格隔开的整数:Ai, Bi,以及Ti.表示一条道路的起点,终点和需要花费的时间.
Output
唯一一行:一个整数: 所有参加聚会的奶牛中,需要花费总时间的最大值.
Sample Input
1 2 4
1 3 2
1 4 7
2 1 1
2 3 5
3 1 2
3 4 4
4 2 3
Sample Output
HINT
样例说明:
共有4只奶牛参加聚会,有8条路,聚会位于第2个农场.
第4只奶牛可以直接到聚会所在地(花费3时间),然后返程路线经过第1和第3个农场(花费7时间),总共10时间.
Source
BZOJ 1631: [Usaco2007 Feb]Cow Party( 最短路 )的更多相关文章
- BZOJ 1631: [Usaco2007 Feb]Cow Party
题目 1631: [Usaco2007 Feb]Cow Party Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 491 Solved: 362[Sub ...
- bzoj 1631: [Usaco2007 Feb]Cow Party【spfa】
正反加边分别跑spfa最短路,把两次最短路的和求个max就是答案 #include<iostream> #include<cstdio> #include<queue&g ...
- 【BZOJ】1631: [Usaco2007 Feb]Cow Party(dijkstra)
http://www.lydsy.com/JudgeOnline/problem.php?id=1631 看到m<=100000果断用dij(可是好像dij比spfa还慢了在这里?)//upd: ...
- BZOJ 1697: [Usaco2007 Feb]Cow Sorting牛排序
Description 农夫JOHN准备把他的 N(1 <= N <= 10,000)头牛排队以便于行动.因为脾气大的牛有可能会捣乱,JOHN想把牛按脾气的大小排序.每一头牛的脾气都是一个 ...
- bzoj 1119 [POI2009]SLO && bzoj 1697 [Usaco2007 Feb]Cow Sorting牛排序——思路(置换)
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1119 https://www.lydsy.com/JudgeOnline/problem.p ...
- bzoj 1697: [Usaco2007 Feb]Cow Sorting牛排序【置换群】
至今都不知道置换群是个什么东西--题解说什么就是什么.jpg 以下来自hzwer:http://hzwer.com/3905.html #include<iostream> #includ ...
- BZOJ 1697: [Usaco2007 Feb]Cow Sorting牛排序(置换+贪心)
题面 Description 农夫JOHN准备把他的 N(1 <= N <= 10,000)头牛排队以便于行动.因为脾气大的牛有可能会捣乱,JOHN想把牛按脾气的大小排序.每一头牛的脾气都 ...
- BZOJ1631: [Usaco2007 Feb]Cow Party
1631: [Usaco2007 Feb]Cow Party Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 459 Solved: 338[Submit ...
- 【BZOJ 1697】1697: [Usaco2007 Feb]Cow Sorting牛排序
1697: [Usaco2007 Feb]Cow Sorting牛排序 Description 农夫JOHN准备把他的 N(1 <= N <= 10,000)头牛排队以便于行动.因为脾气大 ...
随机推荐
- 【转】几个常用的Oracle存储过程
http://blog.bossma.cn/database/some-oracle-storing-process/ 几个常用的Oracle存储过程 发布时间:2008年1月6日 / 分类:Data ...
- Windows Server 2012 R2 Standard序列号
备用一个吧,免得用起来的时候找不到. NB4WH-BBBYV-3MPPC-9RCMV-46XCB
- Bluetooth 2.1+EDR是什么
目前应用最为广泛的是 Bluetooth 2.0+EDR标准,该标准在2004年已经推出,支持Bluetooth 2.0+EDR标准的产品也于2006年大量出现.虽然Bluetooth 2.0+EDR ...
- UVA122-Trees on the level(链二叉树)
Trees on the level Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu Sub ...
- Cocos2d-x3.0 捕Android菜单键和返回键
原文地址:http://blog.csdn.net/qqmcy/article/details/26172665 .h void onKeyReleased(EventKeyboard::KeyCod ...
- linux之iptable
转自:http://seanlook.com/2014/02/23/iptables-understand/ 一. netfilter与iptables Netfilter是由Rusty Russel ...
- 文件上传下载样式 --- bootstrap
在平时工作中,文件上传下载功能属于不可或缺的一部分.bootstrap前端样式框架也使用的比较多,现在根据bootstrap强大的样式模板,自定义一种文件下载的样式. 后续会使用spring MVC框 ...
- input file 模拟
<html> <head> <meta http-equiv="Content-Type" content="text/html; char ...
- ie6与固定定位fixed,+ 条件注释格式注意
ie6并不支持position:fixed, ie7+都支持fixed定位, ie6固定定位实现方法1: <!DOCTYPE html> <html> <head> ...
- SIGAR - System Information Gatherer And Reporter
https://support.hyperic.com/display/SIGAR/Home 收藏一篇: http://www.cnitblog.com/houcy/archive/2012/11/2 ...