Driver code
if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT n = 4 ; NEW_LINE k = 2 ; NEW_LINE ele = [ 0 , 2 , 6 , 4 , 8 ] NEW_LINE cost = [ 0 , 40 , 20 , 30 , 10 ] NEW_LINE ans = minCost ( 1 , 0 , 1 , ele , cost ) ; NEW_LINE if ( ans == 100000 ) : NEW_LINE INDENT ans = - 1 ; NEW_LINE DEDENT print ( ans ) NEW_LINE DEDENT