做这道题的动机就是想练习一下堆的应用,顺便补一下好久没看的图论算法. Dijkstra算法概述 //从0出发的单源最短路 dis[][] = {INF} ReadMap(dis); for i = 0 -> n - 1 d[i] = dis[0][i] while u = GetNearest(1 .. n - 1, !been[]) been[u] = 1 for_each edge from u d[edge.v] = min(d[edge.v], d[u] + dis[u][edge.v]…
POJ 2502 Subway / NBUT 1440 Subway / SCU 2186 Subway(图论,最短距离) Description You have just moved from a quiet Waterloo neighbourhood to a big, noisy city. Instead of getting to ride your bike to school every day, you now get to walk and take the subway.…
Subway Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6689 Accepted: 2176 Description You have just moved from a quiet Waterloo neighbourhood to a big, noisy city. Instead of getting to ride your bike to school every day, you now get…