A11703 | Messages
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
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$ ).
The second string contains $n$ integers $t_{i}$ ( $1<=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.
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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted