Not All Roads Lead There

Computer Science Level 5

During a battle, Sheldor the conqueror notices that his cities are in the form of a Directed Acyclic Graph, i.e, all the roads are one-way and there is no sequence of roads starting from a city that comes back into it.

City 1 is completely under Sheldor's control and he uses it as the base shelter for his troops. He intends to send a number of troops to City 30. How many distinct paths could these troops take?

Input File: Link

Input Format and Details:

  • There are 30 cities numbered from 1 to 30.
  • Each line of the file contains two integers u v in that order. This means that there is a directed edge from u to v.
  • To reiterate, you need to find the number of paths from vertex 1 to vertex 30

Problem Loading...

Note Loading...

Set Loading...