文件名称:poj
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:863byte
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
pku 3613 Cow Relays
题意:给一个无向图,求从起点s到终点e尽力n条边的路径最小值。
边的数量2<=t<=100(每条边可以重复遍历)
算法:利用dp求出 path[ l ] [ i ] [ k ]=MIN(path[ l ][ i ] [ k ] , path[ l ][ i ] [ j ] + path[ l ][ j ] [ k ])
l 表示的是2的指数,假设 i 到 k 要途径 2^l 条边,那么他可以被分为两段 途径2^(l - 1)的路径。
利用开始的输入,然后递推,就可以推出所有的状态。
当需要找途经N条边的路径最小值时.将上面的值有效的组合起来.
上面求出了 1 2 4 8 16 …… 时的任意两条边的代价
对应的二进制是 1 10 100 1000 10000 ……
N可以拆成相应的二进制,然后用类似矩阵相乘的方法,往下推,就得到答案
m表示节点个数,(aXb)表示a行b列的矩阵一个 ,那么(1Xm)* path[ l ](mXm) 。
最终复杂度为O(t^3logn)
-Cow Relays
Time Limit: 1000MS Memory Limit: 65536K
Total Submissions: 1163 Accepted: 433
Descr iption
For their physical fitness program, N (2 ≤ N ≤ 1,000,000) cows have decided to run a relay race using the T (2 ≤ T ≤ 100) cow trails throughout the pasture.
Each trail connects two different intersections (1 ≤ I1i ≤ 1,000 1 ≤ I2i ≤ 1,000), each of which is the termination for at least two trails. The cows know the lengthi of each trail (1 ≤ lengthi ≤ 1,000), the two intersections the trail connects, and they know that no two intersections are directly connected by two different trails. The trails form a structure known mathematically as a graph.
To run the relay, the N cows position themselves at various intersections (some intersections might have more than one cow). They must position themselves properly so that they can hand off the baton cow-by-cow and end up at the proper finishing place.
Write a program to help position the cows. Find the shortest path that
题意:给一个无向图,求从起点s到终点e尽力n条边的路径最小值。
边的数量2<=t<=100(每条边可以重复遍历)
算法:利用dp求出 path[ l ] [ i ] [ k ]=MIN(path[ l ][ i ] [ k ] , path[ l ][ i ] [ j ] + path[ l ][ j ] [ k ])
l 表示的是2的指数,假设 i 到 k 要途径 2^l 条边,那么他可以被分为两段 途径2^(l - 1)的路径。
利用开始的输入,然后递推,就可以推出所有的状态。
当需要找途经N条边的路径最小值时.将上面的值有效的组合起来.
上面求出了 1 2 4 8 16 …… 时的任意两条边的代价
对应的二进制是 1 10 100 1000 10000 ……
N可以拆成相应的二进制,然后用类似矩阵相乘的方法,往下推,就得到答案
m表示节点个数,(aXb)表示a行b列的矩阵一个 ,那么(1Xm)* path[ l ](mXm) 。
最终复杂度为O(t^3logn)
-Cow Relays
Time Limit: 1000MS Memory Limit: 65536K
Total Submissions: 1163 Accepted: 433
Descr iption
For their physical fitness program, N (2 ≤ N ≤ 1,000,000) cows have decided to run a relay race using the T (2 ≤ T ≤ 100) cow trails throughout the pasture.
Each trail connects two different intersections (1 ≤ I1i ≤ 1,000 1 ≤ I2i ≤ 1,000), each of which is the termination for at least two trails. The cows know the lengthi of each trail (1 ≤ lengthi ≤ 1,000), the two intersections the trail connects, and they know that no two intersections are directly connected by two different trails. The trails form a structure known mathematically as a graph.
To run the relay, the N cows position themselves at various intersections (some intersections might have more than one cow). They must position themselves properly so that they can hand off the baton cow-by-cow and end up at the proper finishing place.
Write a program to help position the cows. Find the shortest path that
相关搜索: pku3613
(系统自动生成,下载前可以参看下载内容)
下载文件列表
poj.text
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.