People are crazy about WWE in ‘xyz’ state. There’s a long queue in front of ticket counter. Here are the queue considerations.
“WWE fans” who are entering in to the ticketing premises to book the tickets don’t have any idea of Optimal Path & time required to reach the ticket counter. So there is a need to design a system that can suggest the fans what is the “Optimal Path” and its “Expected Time for reaching the counter”
For the given problem, the input will consist of:
Given the current snapshot of number of people on each queue, Calculate the minimum time for a person to reach the ticket counter who is just about to enter any queue. Also, output the path that he should take to reach the counter in minimum time in the worst case(at each junction point, the policeman starts choosing people from the in-queue other than the one we are calculating the minimum time for).
Note : If multiple optimal paths are possible, print each of the path in a separate line sorted wrt to the first node
The first line contains the number of junctions 'n'(<200).
The second line contains the number of queues 'e'(<200).
The next 'e' lines contains three values: the start junction, the end junction and the number of people on this queue(This is also the max. number of people that can stand in this queue)
Optimal Time
Path(s)
Ticket counter point: 7
Entry points: 1, 2, 3, 4
Time required for a person who is just entering the queue from entry point 3:
Note: queue(a, b) means queue-line between a and b junction points