{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cstyle type\u003d\"text/css\"\u003e\nh1,h2,h3,h4,h5,h6{margin-bottom:0;}div.textBG p{margin: 0 0 0.0001pt;}\u003c/style\u003e\n\u003cp\u003e\n\t\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\n\tWrite a program that looks for vertices in a directed graph that are inaccessible from a particular beginning vertex.\nA directed graph is made up of n vertices, where 1\u003c\u003d n \u003c\u003d100 are numbered 1... n sequentially.\n\nand a sequence of p -\u003e q edges that connect the nodes p and q in just one way.\n\nIf an edge p -\u003e r exists, or if any vertex q exists, a vertex r may be reached from a vertex p.\n\nFor which q can be reached from p and r can be reached from q.\n\nIf a vertex r is not reachable from p, then it is inaccessible.\u003c/p\u003e\n\u003cp\u003e\n\t\u0026nbsp;\u003c/p\u003e\n\u003ch2\u003e\n\t\u003cfont color\u003d\"#0070E8\"\u003e\u003ca name\u003d\"SECTION0001001000000000000000\"\u003eInput\u003c/a\u003e\u003c/font\u003e\u003c/h2\u003e\n\u003cp\u003e\n\tThe input data for this program consists of several directed graphs and starting nodes.\u003c/p\u003e\n\u003cp\u003e\n\t\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\n\tFor each graph, there is first one line containing a single integer \u003ci\u003en\u003c/i\u003e. This is the number of vertices in the graph.\u003c/p\u003e\n\u003cp\u003e\n\t\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\n\tFollowing, there will be a group of lines, each containing a set of integers. The group is terminated\nby a line which contains only the integer ‘0’. Each set represent a collection of edges. The first integer\nin the set, i, is the starting vertex, while the next group of integers, j . . . k, define the series of edges\ni -\u003e j . . . i -\u003e k, and the last integer on the line is always ‘0’. Each possible start vertex i, 1 ≤ i ≤ n\nwill appear once or not at all. Following each graph definition, there will be one line containing a list\nof integers. The first integer on the line will specify how many integers follow. Each of the following\nintegers represents a start vertex to be investigated by your program. The next graph then follows. If\nthere are no more graphs, the next line of the file will contain only the integer ‘0’.\u003c/p\u003e\n\u003cp\u003e\n\t\u0026nbsp;\u003c/p\u003e\n\u003ch2\u003e\n\t\u003cfont color\u003d\"#0070E8\"\u003e\u003ca name\u003d\"SECTION0001002000000000000000\"\u003eOutput\u003c/a\u003e\u003c/font\u003e\u003c/h2\u003e\n\u003cp\u003e\n\tFor each start vertex to be investigated, your program should identify all the vertices which are inaccessible from the given start vertex. Each list should appear on one line, beginning with the count of inaccessible vertices and followed by the inaccessible vertex numbers.\u003c/p\u003e\n\u003cp\u003e\n\t\u0026nbsp;\u003c/p\u003e\n\u003ch2\u003e\n\t\u003cfont color\u003d\"#0070E8\"\u003e\u003ca name\u003d\"SECTION0001003000000000000000\"\u003eSample Input\u003c/a\u003e\u003c/font\u003e\u003c/h2\u003e\n\u003cp\u003e\n\t\u0026nbsp;\u003c/p\u003e\n\u003cpre\u003e\n3\n1 2 0\n2 2 0\n3 1 2 0\n0\n2 1 2\n0\u003c/pre\u003e\n\u003cp\u003e\n\t\u0026nbsp;\u003c/p\u003e\n\u003ch2\u003e\n\t\u003cfont color\u003d\"#0070E8\"\u003e\u003ca name\u003d\"SECTION0001004000000000000000\"\u003eSample Output\u003c/a\u003e\u003c/font\u003e\u003c/h2\u003e\n\u003cp\u003e\n\t\u0026nbsp;\u003c/p\u003e\n\u003cpre\u003e\n2 1 3\n2 1 3\u003c/pre\u003e"}}]}