文件名称:poj
介绍说明--下载内容均来自于网络,请自行研究使用
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