Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

3个dfs也0ms过了

Posted by onlyzeus at 2009-08-27 23:26:39 on Problem 2157
第一步:每次拿钥匙并检查能否开门;这一步拿过的钥匙要改为‘.’,开过的门也要改为‘.’
第二步:重复第一步的过程;
第三步:最后一次dfs,如果在整个图中能找到G就ok了
具体想法其实想下也不难,第一二步是为了能够打开从S出发能够打开的所有门;至于为什么要两步呢?第一步肯定会遍历能够遍历的点 但第一次遇见门时不一定拿到了该拿到的钥匙;于是在遍历一次该开的门开;


Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator