## MWC '15 #2 P4: Robotics Summative

View as PDF

Points: 5 (partial)
Time limit: 3.0s
Memory limit: 256M

Author:
Problem type

Robotics (TER4M) is an intensive course at William Lyon Mackenzie CI, which requires students to program and design advanced machinery. atarw however prioritizes his top-6 marks, and doesn't quite put as much effort into the project. The ISP, worth 30% of the final mark, is supposed to pick up tennis balls and throw them over a wall where the opponent is also throwing tennis balls over. The player to throw the most tennis balls into the opponent's field during 2 minutes win.

However, atarw has a genius strategy. He's going to build rectangles using VEX pieces and block off all the opponent's shots. He is limited to using only rectangles, so there needs to be 2 pairs of equal sides or all equal sides. In addition, he also has time to cut off 1 cm if required off every piece to build a rectangle. Given sticks, each with a maximum length of , compute the total area of rectangles that can be built to shield the robot and not throw the balls over.

#### Input Specification

The first line will contain integers (number of pieces), followed by numbers indicating each respective length (separated by space).

Note: Fast input may be required.

#### Output Specification

Output the largest possible area.

#### Sample Input

4
2 2 4 5

#### Sample Output

8

#### Explanation

We can take the piece with 4 cm as the width, take the 5 cm piece and cut off 1 cm so it's also the width, and then take the 2 cm pieces as the height. The area is .