Faulty Robot: Difference between revisions

From programming_contest
Jump to navigation Jump to search
imported>Kmk21
Created page with "This problem asks us to find the set of sink nodes while traversing a graphs by a set of edges with a caveat that we may traverse a second set of "fault" edges, but only one s..."
 
imported>Kmk21
No edit summary
 
Line 5: Line 5:
[[Category:ICPC Problems]]
[[Category:ICPC Problems]]
[[Category:Mcpc2017]]
[[Category:Mcpc2017]]
[[Category:Scusa2017]]
[[Category:Algorithm Medium]]
[[Category:Algorithm Medium]]
[[Category:Implementation Easy]]
[[Category:Implementation Easy]]

Latest revision as of 20:34, 29 December 2017

This problem asks us to find the set of sink nodes while traversing a graphs by a set of edges with a caveat that we may traverse a second set of "fault" edges, but only one such edge may ever be traversed.

This is a standard state explosion problem. Without the "fault" edges, we could simply BFS and check which nodes don't allow us to progress further. With the "fault" edges, we add a second variable to our state to track whether we've taken some fault edge already. If we have not, we BFS along any edge, fault or regular. If we have, we may only traverse along regular edges.