unweighted专题

Sicily Shortest path in unweighted graph

Source: http://soj.sysu.edu.cn/show_problem.php?pid=1003&cid=2104 Description 输入一个无向图,指定一个顶点s开始bfs遍历,求出s到图中每个点的最短距离。 如果不存在s到t的路径,则记s到t的距离为-1。 Sample Input 输入的第一行包含两个整数n和m,n是图的顶点数,m是边数。1<=n<=1000