Company: Flipkart_13july
Difficulty: medium
Super Tunnel Maintenance Problem Description A mountain rail authority operates a network of tunnels through a hilly region. A tunnel is called a super tunnel if, whenever it collapses or is taken offline, some areas that were previously reachable through it can no longer be reached at all. A complete map of every tunnel, super tunnels included, comes attached to the maintenance contract. Your firm is bidding on the contract, and the finance department has supplied the upkeep cost for each tunnel individually. You need to work out which tunnels qualify as super tunnels and what the combined upkeep cost of just those tunnels will be. Write a program that identifies the super tunnels and prints the resulting cost. Read the Input from STDIN and print the output to STDOUT. Do not write arbitrary strings anywhere in the program, as these contribute to the standard output and testcases will fail. Input Format First line consists of an integer n, which is the number of tunnels. Tunnels are re