Company: Flipkart_9nov
Difficulty: medium
Shortest Path Between Queried Colored Vertices Problem Description Consider an undirected weighted graph G(V,E), where V and E denote its number of vertices and edges. Every vertex is assigned a colour, and vertices are grouped into pairs that share the same colour. There are |V/2| pairs (if V is even) or |(V+1)/2| pairs (if V is odd), and a distinct colour is used for each pair. A query Q supplies one of the colours used among these paired vertices. Write a program that finds the shortest path (by total weight) between the two vertices sharing the colour given in Q. Read the input from STDIN and print the output to STDOUT. Do not print any extra text anywhere in the program, since anything printed becomes part of the graded output and will cause test cases to fail. Constraints Z <= V <= 100 Z <= E <= 100 Z <= C <= 100 Input Format The first line of input contains two integers V and E separated by a single space, where V is the number of vertices and E is the number o