题意:
给出一个n个结点m条边有向图,可能有负权边;
但是存在负权边a->b则不会有某个路径可以从b到a;
求一个源点s到所有点的最短路(无解输出"NO PATH");
n
题解:
高高兴兴的写了一发spfa,O(km)嘛;
然后就TLE了,这题丧心病狂的把spfa卡掉了;
这时候理所当然的想到了dij+heap,写到一半想起来不支持负权边;
所以这个不是一个简单的单源最...
分类:
其他好文 时间:
2015-06-15 09:26:24
阅读次数:
132
树形dp..水------------------------------------------------------------------------#include#include#include#include#define rep( i , n ) for( int i = 0 ; i...
分类:
其他好文 时间:
2015-06-14 21:24:19
阅读次数:
175
查看数据库监听状态不对$ lsnrctl statusLSNRCTL for IBM/AIX RISC System/6000: Version 10.2.0.5.0 - Production on 05-NOV-2012 08:54:08Copyright (c) 1991, 2010, Orac...
分类:
其他好文 时间:
2015-06-11 22:45:49
阅读次数:
238
水dp先按开始时间排序 , 然后dp.dp( i ) 表示前 i 个时间段选第 i 个时间段的最优答案 , 则 dp( i ) = max( dp( j ) ) + w_i ( 0 #include#include#include#define rep( i , n ) for( int i = 0...
分类:
其他好文 时间:
2015-06-09 21:31:41
阅读次数:
102
题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1030
题意:基础概率题。
代码:#include
#include
#include
#include
#include
#include ...
分类:
其他好文 时间:
2015-06-08 23:29:29
阅读次数:
348
Description
FJ is about to take his N (1 ≤ N ≤ 30,000) cows to the annual"Farmer of the Year" competition. In this contest every farmer arranges his cows in a line and herds them past the judges.
...
分类:
编程语言 时间:
2015-06-08 23:25:46
阅读次数:
195
一开始直接 O( n² ) 暴力..结果就 A 了... USACO 数据是有多弱 = =先sort , 然后自己再YY一下就能想出来...具体看code-------------------------------------------------------------------------...
分类:
其他好文 时间:
2015-06-08 21:15:16
阅读次数:
116
状压dpdp( x , S ) 表示最后一个是 x , 当前选的奶牛集合为 S , 则状态转移方程 : dp( x , S ) = Σ dp( i , S - { i } ) ( i ∈ S , abs( h[ i ] - h[ x ] ) > k )-----------------------....
分类:
其他好文 时间:
2015-06-08 18:48:51
阅读次数:
124
Description混乱的奶牛 [Don Piele, 2007] Farmer John的N(4 .#include#define ll long longusing namespace std;const int maxn=16;int n,k,a[maxn];ll f[1k) ...
分类:
其他好文 时间:
2015-06-07 23:14:59
阅读次数:
162
DescriptionFarmer John尝试通过和奶牛们玩益智玩具来保持他的奶牛们思维敏捷. 其中一个大型玩具是牛栏中的灯. N (2 2 #include 3 using namespace std; 4 const int maxn=4e5+5; 5 6 int tag[maxn],su.....
分类:
其他好文 时间:
2015-06-07 18:45:19
阅读次数:
111