CF89A.Robbery

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has nn cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells with positive numbers from 11 to nn from the left to the right.

Unfortunately, Joe didn't switch the last security system off. On the plus side, he knows the way it works.

Every minute the security system calculates the total amount of diamonds for each two adjacent cells (for the cells between whose numbers difference equals 11 ). As a result of this check we get an n1n-1 sums. If at least one of the sums differs from the corresponding sum received during the previous check, then the security system is triggered.

Joe can move the diamonds from one cell to another between the security system's checks. He manages to move them no more than mm times between two checks. One of the three following operations is regarded as moving a diamond: moving a diamond from any cell to any other one, moving a diamond from any cell to Joe's pocket, moving a diamond from Joe's pocket to any cell. Initially Joe's pocket is empty, and it can carry an unlimited amount of diamonds. It is considered that before all Joe's actions the system performs at least one check.

In the morning the bank employees will come, which is why Joe has to leave the bank before that moment. Joe has only kk minutes left before morning, and on each of these kk minutes he can perform no more than mm operations. All that remains in Joe's pocket, is considered his loot.

Calculate the largest amount of diamonds Joe can carry with him. Don't forget that the security system shouldn't be triggered (even after Joe leaves the bank) and Joe should leave before morning.

输入格式

The first line contains integers nn , mm and kk ( 1<=n<=1041<=n<=10^{4} , 1<=m,k<=1091<=m,k<=10^{9} ). The next line contains nn numbers. The ii -th number is equal to the amount of diamonds in the ii -th cell — it is an integer from 00 to 10510^{5} .

输出格式

Print a single number — the maximum number of diamonds Joe can steal.

输入输出样例

  • 输入#1

    2 3 1
    2 3
    

    输出#1

    0
  • 输入#2

    3 2 2
    4 1 3
    

    输出#2

    2

说明/提示

In the second sample Joe can act like this:

The diamonds' initial positions are 44 11 33 .

During the first period of time Joe moves a diamond from the 11 -th cell to the 22 -th one and a diamond from the 33 -th cell to his pocket.

By the end of the first period the diamonds' positions are 33 22 22 . The check finds no difference and the security system doesn't go off.

During the second period Joe moves a diamond from the 33 -rd cell to the 22 -nd one and puts a diamond from the 11 -st cell to his pocket.

By the end of the second period the diamonds' positions are 22 33 11 . The check finds no difference again and the security system doesn't go off.

Now Joe leaves with 22 diamonds in his pocket.

首页