|
||||||||||
A sample Hamilton pathTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1349 Accepted Submission(s): 454 Problem Description Give you a Graph,you have to start at the city with ID zero. Input The first line is n(1<=n<=21) m(0<=m<=3) The next n line show you the graph, each line has n integers. The jth integers means the length to city j.if the number is -1 means there is no way. If i==j the number must be -1.You can assume that the length will not larger than 10000 Next m lines,each line has two integers a,b (0<=a,b<n) means the path must visit city a first. The input end with EOF. Output For each test case,output the shorest length of the hamilton path. If you could not find a path, output -1 Sample Input
Sample Output
Hint I think that all of you know that a!=b and b!=0 =¡£= Source | ||||||||||
|