the shortest path that go through all k vertices?

Revision en4, by Iwillgotit, 2023-11-13 18:03:15

+Given a directed and weighted graph and k vertices.Find the shortest path that go through all k vertices?
time limit : 3 seconds

+input:
first line contain n,m,k : n is number of vertices ,m is number of edges,k is number of givens vertices
second line contain k vertices
m last lines contain x,y,z : that mean have a edge conect between x and y and z is the weight of this edge

example
+constrains: 1<=k<=n<=20

Input:
6 10 3
4 5 6
1 2 1
2 3 3
3 4 3
4 5 1
5 6 3
6 1 3
1 5 1
6 3 3
2 4 1
5 3 3

Output: 4

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English Iwillgotit 2023-11-13 18:03:15 54
en3 English Iwillgotit 2023-11-12 12:25:48 0 (published)
en2 English Iwillgotit 2023-11-12 12:20:48 11 (saved to drafts)
en1 English Iwillgotit 2023-11-12 12:19:01 655 Initial revision (published)