Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
题解设一个 money[1001][101] 表示 到点i时, 油量为j 的最小花费; 然后用dijstra的广搜变种来搜即可: 每次找一个最小花费点, if money[x][y + 1]满足, 拓展入队即可; 然后再更新x的邻点入队拓展即可; dijstra的宽搜变种模板: int d[] ; s入堆; while (size) t = top() ; // 出堆; if 找到终点v return d[v] ; mark [t] = 1 ;标记; 拓展: if (! mark[p -> n] && d[ p -> n] > d[t] + p -> v ) 入堆; return -1 ; Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator