Question: C++ programing question21 Treasure Hunting Time Limit: 3 Seconds There are n cities numbered from 0 to n ? 1. At each of the city

C++ programing question21

Treasure Hunting Time Limit: 3 Seconds

There are n cities numbered from 0 to n ? 1. At each of the city v, there is a treasure with value c(v). Also, there are some roads connecting some pairs of cities. If there is a road (u, v), one can go from city u to city v. Note that the roads are one-way, which means that one cannot go from v to u unless there is also a road (v, u). Mike is a treasure hunter. The King tell Mike: Mike, I will give you some choices of the starting city. According

to your choice, you will be sent to the city and you can go wher- ever you can reach.

But you can take only one treasure. Mike, here is the map and good luck. Please help Mike to find the most valued treasure. Technical Specification For problem 11: 1. n ? 200. 2. m ? 40000. 3. All the values of treasures are 32-bits nonnegative integers. For problem 12: 1. n ? 5000. 2. The number of roads is at most 100000. 3. All the values of treasures are 32-bits nonnegative integers.

1

Input File Format Each test case contains one map and several starting cities. For each test case, the first line contains the three integers n, m and t, in which t is the number of starting cities in this case. You may assume that 0

C++ programing question21 Treasure Hunting Time Limit: 3 Seconds There are n

Input 5 42 0 4 1 2 3 52 0 1 1 0 3 4 Output for the Sample Input 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!