读书人

UVa 208 - Firetruck双向搜索进展剪

发布时间: 2012-08-19 21:09:48 作者: rapoo

UVa 208 - Firetruck,双向搜索进行剪枝

UVa  208 - Firetruck,双向搜索进展剪枝208 - Firetruck667516.87%153454.76%

题目链接:

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=108&page=show_problem&problem=144


类型: 回溯法


原题:

The Center City fire department collaborates with the transportation department to maintain maps of the city which reflects the current status of the city streets. On any given day, several streets are closed for repairs or construction. Firefighters need to be able to select routes from the firestations to fires that do not use closed streets.

Central City is divided into non-overlapping fire districts, each containing a single firestation. When a fire is reported, a central dispatcher alerts the firestation of the district where the fire is located and gives a list of possible routes from the firestation to the fire. You must write a program that the central dispatcher can use to generate routes from the district firestations to the fires.

Input

The city has a separate map for each fire district. Streetcorners of each map are identified by positive integers less than 21, with the firestation always on corner #1. The input file contains several test cases representing different fires in different districts.

读书人网 >编程

热点推荐