Codeforces Round #297 (Div. 2) C

In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set ofnsticks and an instrument. Each stick is characterized by its lengthli.

Ilya decided to make a rectangle from the sticks. And due to his whim, he decided to make rectangles in such a way that maximizes their total area. Each stick is used in making at most one rectangle, it is possible that some of sticks remain unused. Bending sticks is not allowed.

Sticks with lengthsa1,a2,a3anda4can make a rectangle if the following properties are observed:

a1≤a2≤a3≤a4a1=a2a3=a4

A rectangle can be made of sticks with lengths of, for example,3333or2244. A rectangle cannot be made of, for example, sticks5557.

Ilya also has an instrument which can reduce the length of the sticks. The sticks are made of a special material, so the length of each stick can be reduced by at most one. For example, a stick with length5can either stay at this length or be transformed into a stick of length4.

You have to answer the question — what maximum total area of the rectangles can Ilya get with a file if makes rectangles from the available sticks?

,同时也用对她的怀念来惩罚自己。

Codeforces Round #297 (Div. 2) C

相关文章:

你感兴趣的文章:

标签云: