Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Coding 7 7 3 Description Problem Statement There are n cities and m one - directional roads connecting the city A [ i ] to

Coding
773
Description
Problem Statement
There are n cities and m one-directional roads connecting the city A[i] to city B[i]. We are in the panner-making business. Each city has set its own price of paneer. You can buy or sell paneer in the city i for val rupees. You have to bury paneer from some city u and sell the paneer in another city v. The profit that you make is calculated as the selling price minus buying price. Return an integer denoting the maximum profit you can make. NOTE: In all, it is mandatory to buy only 1 paneer and it is mandatory to sell that paneer in some other city that can be travelled from it.
Input Format
The firstline contains n the number of qities.
The next n lines contain the elements of the array val.
The next line contains an integer m.
The next m lines contain the array of elements A.
The next line again contains the integer m.
The next m lires contain the array of clements B
Constraints
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions