Question: Write efficient C++ code for the following program.Also explain your logic You are given two sequences A 1 ,A 2 ,,A N and B 1

Write efficient C++ code for the following program.Also explain your logic  

You are given two sequences A1,A2,…,AN and B1,B2,…,BN. You should choose a permutation P1,P2,…,PN of the integers 1 through N and construct N rectangles with dimensions A1×BP1,A2×BP2,…,AN×BPN Then, for each of these rectangles, you should construct an inscribed circle, i.e. a circle with the maximum possible area that is completely contained in that rectangle.

Let S be the sum of diameters of these N circles. Your task is to find the maximum value of S.

Step by Step Solution

3.46 Rating (149 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

include include using namespace std int main int nans0 Initial... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithms Questions!