Company: Infoedge_23aug
Difficulty: medium
Paneer and Profit Problem Description There are n cities and m one-directional roads connecting city A[i] to city B[i]. You run a small paneer-trading business, and each city has its own local price for paneer: you may buy or sell a block of paneer in city i for val i rupees. You must purchase paneer in some city u and sell it in a different city v, reachable from u by road. Your profit equals the selling price minus the buying price. Return an integer giving the maximum profit achievable. NOTE: You are required to buy exactly one block of paneer, and you must sell it in some other city that can be travelled to from where it was bought. Input Format The first line contains n, the number of cities. The next n lines contain the elements of the array val. The next line contains an integer m. The next m lines contain the elements of array A. The next line again contains the integer m. The next m lines contain the elements of array B. Output Format Return an integer giving the maximum possi