|
|
вернуться в форумsubj Try to use cash. Why cash? More explanations may be? At me too a problem on 21 test. Please, Help to solve this problem What do U mean "cash"? How to do it? Will it be quicker? Thanks. It's obviously a directed graph. We find its strongly-connected-components. Now if one of the vertices in one component satisfies the problem the other vertices in its component do. so we merge each component into one vertex. the remaining graph is a DAG (directed acyclic graph). the component which its in-degree is zero is the answer. and if there are more than one component with in-degree==zero then we have no answer because the graph is not connected. |
|
|