complete the function solve preferably in Python3 or Java8, kindly consider the constraints as multiple hidden test cases need to be passed.
End Question 1 Max. score: 100.00 Minimum Cost to reach destination Problem Statement: Ram is current at city 1 and wants to reach city N. While crossing cities he can either go from city i to city i+1 by spending cost cior use a bridge that connects city i to city ju >1). Each bridge has its own travel cost. Ram doesn't likes to travel from bridges much so he decides not to take more than K bridges during his journey. Since Ram is on a tight budget can you help Ram find out the minimum cost to reach city N. Example Assume that N = 3, M = 1, K = 1, c = [2.4) Bridges: 135 The cost of going from 1 to 3 using connections is 6. or we can use 1 bridge and go from 1 to 3 using cost 5. There the answer is 5. Function description Complete the solve function provided in the editor. This function takes the following 5 parameters and returns the minimum cost Ram needs to reach city N N: Represents the number of cities M: Represents the number of bridges. K: Represents the number of bridges that can be atmost used C: An array representing the cost of connection of i and i+1 city . b: A 2D array, with each row denoting the bridge between 2 cities and its cost Input Format: Note: This is the input format that you must use to provide custom input (available above the Compile and Test button). The first line of the input contains N, Mand K- the number of cities, the total number of bridges and the maximum number of bridges you can take. . The second line contains N-1 integers c_1_2...., _n-1 where is the cost of traveling from city I to city #1 Then M lines follow: Then M lines follow: . Each line contains A, B and D which means that there is a bridge between A and B, and the cost of traveling through that bridge is D. Output Format: Print one integer - the minimum cost Ram needs to spend to reach city N. Constraints 13->4->5). Total cost will be ( 2 +1+4 = 7) Note: Your code must be able to print the sample output from the provided sample input. However, your code is run against multiple hidden test cases. Therefore, your code must pass these hidden test cases to solve the problem statement. Time Limit: 10 sec(s) for each input file Memory Limit: 256 MB Source Limit: 1024 KB Marking Scheme: Scores assigned If any testcase passes Save Python 3 (python 3.5.2) 1 def solve (N, M, K, C, b): # Write your code here WN 4 5 N,M,K = map(int, input().split() 1 6 c = list(map(int, input().split())) 7 b = [list(map(int, input().split())) for i in range(M)] 8 9 out_ = solve(N, M, K, C, b) 10 print (out) 3 Save Java 8 (oracle 1.8.0_131) 1 import java.io.*; 2 import java.util.*; 3 public class TestClass { 4 public static void main(String[] args) throws IOException { 5 BufferedReader br = new BufferedReader(new InputStreamReader(System.in ): 6 Printwriter wr = new Printwriter(System.out); 7 String[] = br.readLine().split(" "); 8 int N = Integer.parseInt(ip[0]); 9 int M = Integer.parseInt(ip[1]); 10 int K = Integer.parseInt(ip[2]); 11 String[] arr_c = br.readLine().split(""); 12 int[] c = new int[N-1]; 13 for(int ic 0; i c