Company: Google_25oct
Difficulty: medium
Rectangle Formation Problem Description Given two arrays L and B with N elements. We need to form N rectangles using (Length, Breadth) pair from two arrays L and B. Every element of both the arrays must be included in exactly one rectangle formation. We need to find the maximum value of given function :- ∑ (D i ) 2 where D i represents the diameter of the circle touching all the vertices of the i th Rectangle. (1 ≤ i ≤ N, 1 based indexing is followed) Input Format Input: First line contain an integer T, denoting number of test cases. Input: First line of each test case contain an integer N. Input: Second line of each test case contain N space separated integers, denoting array L. Input: Third line of each test case contain N space separated integers, denoting array B. Output Format Print the maximum value of function for every test case in a new line. Examples Example 1: Input: 1 4 2 1 4 3 5 1 4 2 Output: 76 Explanation: We can form rectangles with { Length, Breadth }