Company: Hushh Ai_15oct
Difficulty: medium
Coins Respawn Problem Description There is a directed graph with N vertices numbered 1 to N and M edges. The i-th edge is directed from Vertex A i to Vertex B i , and there are C i coins placed along that edge. Additionally, there is a button on Vertex N. We will play a game on this graph. You start the game on Vertex 1 with zero coins, and head for Vertex N by traversing the edges while collecting coins. It takes one minute to traverse an edge, and you can collect the coins placed along the edge each time you traverse it. As usual in games, even if you traverse an edge once and collect the coins, the same number of coins will reappear next time you traverse that edge, which you can collect again. When you reach Vertex N, you can end the game by pressing the button. (You can also choose to leave Vertex N without pressing the button and continue traveling.) However, when you end the game, you will be asked to pay T × P coins, where T is the number of minutes elapsed since the star