CF964B.Messages

普及-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

There are n incoming messages for Vasya. The i-th message is going to be received after t__i minutes. Each message has a cost, which equals to A initially. After being received, the cost of a message decreases by B each minute (it can become negative). Vasya can read any message after receiving it at any moment of time. After reading the message, Vasya's bank account receives the current cost of this message. Initially, Vasya's bank account is at 0.

Also, each minute Vasya's bank account receives C·k, where k is the amount of received but unread messages.

Vasya's messages are very important to him, and because of that he wants to have all messages read after T minutes.

Determine the maximum amount of money Vasya's bank account can hold after T minutes.

有 nn 条消息将发送给瓦夏。第 ii 条消息将在 tit_i 分钟后到达。每条消息的初始价值为 AA。消息到达后,其价值每分钟减少 BB(价值可变为负数)。瓦夏可在消息到达后的任意时刻阅读任意一条消息;阅读后,瓦夏的银行账户将获得该消息当前的价值。初始时,瓦夏的银行账户余额为 00。

此外,每分钟瓦夏的银行账户还会收到 C⋅kC \cdot k 的金额,其中 kk 是已到达但尚未阅读的消息数量。

瓦夏的消息对他而言极其重要,因此他希望在 TT 分钟后所有消息均已被阅读完毕。

请确定:在 TT 分钟后,瓦夏的银行账户所能达到的最大金额。

输入格式

The first line contains five integers n, A, B, C and T (1 ≤ n, A, B, C, T ≤ 1000).

The second string contains n integers t__i (1 ≤ t__i ≤ T).

第一行包含五个整数 nn、AA、BB、CC 和 TT(1 ≤ n, A, B, C, T ≤ 10001 ≤ n, A, B, C, T ≤ 1000)。

第二行包含 nn 个整数 tit_i(1 ≤ ti ≤ T1 ≤ t_i ≤ T)。

输出格式

Output one integer — the answer to the problem.

输出一个整数——该问题的答案。

输入输出样例

  • 输入#1

    4 5 5 3 5
    1 5 5 4

    输出#1

    20
  • 输入#2

    5 3 1 1 3
    2 2 2 1 1

    输出#2

    15
  • 输入#3

    5 5 3 4 5
    1 2 3 4 5

    输出#3

    35

说明/提示

In the first sample the messages must be read immediately after receiving, Vasya receives A points for each message, n·A = 20 in total.

In the second sample the messages can be read at any integer moment.

In the third sample messages must be read at the moment T. This way Vasya has 1, 2, 3, 4 and 0 unread messages at the corresponding minutes, he gets 40 points for them. When reading messages, he receives (5 - 4·3) + (5 - 3·3) + (5 - 2·3) + (5 - 1·3) + 5 =  - 5 points. This is 35 in total.

在第一个样例中,消息必须在接收后立即阅读,瓦夏每阅读一条消息获得 AA 分,总共获得 n⋅A=20n \cdot A = 20 分。

在第二个样例中,消息可在任意整数时刻阅读。

在第三个样例中,消息必须在时刻 TT 阅读。此时,瓦夏在对应分钟的未读消息数分别为 1,2,3,41, 2, 3, 4 和 00,因此由此获得 4040 分。而在阅读消息时,他获得 (5−4⋅3)+(5−3⋅3)+(5−2⋅3)+(5−1⋅3)+5=−5(5 - 4 \cdot 3) + (5 - 3 \cdot 3) + (5 - 2 \cdot 3) + (5 - 1 \cdot 3) + 5 = -5 分。总计为 3535 分。

输入解题思路,AI测评打分。不知道怎么写?

首页