Back to Cosmos

Problem Link:

code/online_challenges/src/codechef/SNUG_FIT/README.md

latest756 B
Original Source

Problem Link:

SNUG_FIT

Description

Geometry expert Nitin is thinking about a problem with parabolas, icosahedrons, crescents and trapezoids, but for now, to encourage beginners, he chooses to work with circles and rectangles.

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.