DCP-407: Rectangle Back to All Problems

Medium Divide and Conquer > Dynamic Programming


You have **N** sticks of various length. you have to make a rectangle with maximum possible area. - You can use each stick once - You can ignore a stick if you want (not use it at all) - You can join two or more stick to make a side of rectangle. also you can use a single stick to make a side of rectangle - You **can't** break any sticks . Input: ------ First Line of input contain a integer **T (1<=T<=200)** , The number of Test case<br> Each test case start with an integer **N (4 ≤ N ≤ 15)** denoting the number of sticks. The next line will contain N positive integers separated by spaces, denoting the length of ith sticks. sum of all length will be less than or equal **30** Output: ------- Print a single integer in a line for each test case . maximum possible area of rectangle. if no rectangle is possible, print **0**. Sample Input ------------ 4 5 4 2 1 2 1 15 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 2 1 1 1 1 1 4 5 2 3 1 Sample Output ------------- 4 12 4 0


Problem Setter:

Md. Tariqul Islam

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 2.75
C++ 2.75
C++14 2.75
C# 3.00
Go 3.00
Java 3.00
JavaScript 3.00
Objective-C 3.00
Perl 3.00
PHP 3.00
Python 3.00
Python3 3.00
Ruby 3.00
VB.Net 3.00

Problem Stats

23/75

Solve/Submission

Ranking

# User Language Timing
01 feodorv C 0.00s
02 sahedsohel Cpp 0.31s
03 Bruteforcekid Cpp14 0.64s
04 ksohan Cpp 0.66s
05 Robbinb1993 Cpp 0.70s
06 sayedgkm Cpp 0.93s
07 ssavi Cpp 1.22s
08 emrul Cpp14 1.34s
09 mahbubcseju Cpp 1.92s
10 clkjwdhc Cpp 2.21s
11 tariqiitju Cpp14 2.36s
12 prateepm Cpp14 2.52s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support