Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 398 Weeks Ago, 2 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 17 Sep 2017 My Price 9.00

undirected transport roads

A country has V cities. Certain pairs of cities are connected by undirected transport roads between them. There are E such transport roads. There exists a sequence of roads connecting every city in the the country to every other city.
Among the V cities, K of the cities are good cities.

 

Initially all the cities are free. The country is ruled by two kings. The first king wants no friendship with the second king, while the other king wants friendship with the first king. They now play a game of conquering cities.

 

The first king selects a good city, then the second king selects a good city and so on; until all the good cities are over.
Suppose at the end some good cities belong to kingdom A and others to B. Distance value between the two kingdoms is defined as the sum of shortest distances between each pair of good cities X and Y such that X belongs to A and Y belongs to B.

 

The first king wants to maximize the distance value and other king wants to minimize this. Assuming that both play optimally, find out the distance value after the end of the game.

 

Input

 

First line contain three space separated integers denoting V, E, and K respectively.

 

For next E lines, each line contain 3 space separated integers, u v w, denoting that there is an edge from u to v of length w.

 

The following line contains K space separated integers denoting the indices of the good cities. Indices are given by using 1 based indexation.

 

Output

 

A single integer, the maximum possible distance that can be achieved if both kings play optimally.

 

Constraints

 

  • 2 = V = 200
  • No constraint on E
  • 2 = K = 12
  • 0 = w = 100
  • 1 = u, v = V
  • No two u, v pairs repeat in input.

 

Example

Input: 4 5 3 1 2 5 1 3 2 1 4 3 2 4 2 3 4 2 1 2 4 Output: 7

Answers

(5)
Status NEW Posted 17 Sep 2017 12:09 PM My Price 9.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)