There are N nodes in a graph. The graph is unidirectional with M edges. Of these N nodes in the graph, there are K nodes which are important nodes. Given initial position I, within this graph, the task is to find out, if all K nodes are reachable without travelling a distance greater than V from I.
Input Format:
Input consists of:
First line starts with N, M, I, K and V
Next M lines follow; each contains (Source, Destination, and Distance).
Next line contains K spaced important nodes
Output Format:
Print "Yes" if all K nodes are reachable without travelling a distance greater than V else print "No"
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment