CF10A.Power Consumption Calculation

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Tom is interested in power consumption of his favourite laptop. His laptop has three modes. In normal mode laptop consumes _P_1 watt per minute. _T_1 minutes after Tom moved the mouse or touched the keyboard for the last time, a screensaver starts and power consumption changes to _P_2 watt per minute. Finally, after _T_2 minutes from the start of the screensaver, laptop switches to the "sleep" mode and consumes _P_3 watt per minute. If Tom moves the mouse or touches the keyboard when the laptop is in the second or in the third mode, it switches to the first (normal) mode. Tom's work with the laptop can be divided into n time periods [_l_1, _r_1], [_l_2, _r_2], ..., [l__n, r__n]. During each interval Tom continuously moves the mouse and presses buttons on the keyboard. Between the periods Tom stays away from the laptop. Find out the total amount of power consumed by the laptop during the period [_l_1, r__n].

汤姆对他最喜爱的笔记本电脑的功耗很感兴趣。他的笔记本电脑具有三种工作模式:

  • 在正常模式下,笔记本电脑每分钟消耗 P1P_1 瓦;
  • 自汤姆最后一次移动鼠标或按键盘起 T1T_1 分钟后,屏幕保护程序启动,功耗变为每分钟 P2P_2 瓦;
  • 屏幕保护程序启动后再过 T2T_2 分钟,笔记本电脑进入“睡眠”模式,功耗变为每分钟 P3P_3 瓦。

若汤姆在第二(屏幕保护)或第三(睡眠)模式下移动鼠标或按键盘,笔记本电脑将立即切换回第一(正常)模式。

汤姆使用笔记本电脑的过程可分为 nn 个时间段:[l1, r1], [l2, r2], ..., [ln, rn][l_1,\,r_1],\,[l_2,\,r_2],\,...,\,[l_n,\,r_n]。在每个时间段内,汤姆持续移动鼠标并按键;而在各时间段之间,他远离笔记本电脑。

请计算笔记本电脑在总时间区间 [l1, rn][l_1,\,r_n] 内所消耗的总电能。

输入格式

The first line contains 6 integer numbers n, _P_1, _P_2, _P_3, _T_1, _T_2 (1 ≤ n ≤ 100, 0 ≤ _P_1, _P_2, _P_3 ≤ 100, 1 ≤ _T_1, _T_2 ≤ 60). The following n lines contain description of Tom's work. Each i-th of these lines contains two space-separated integers l__i and r__i (0 ≤ l__i < r__i ≤ 1440, r__i < l__i + 1 for i < n), which stand for the start and the end of the i-th period of work.

第一行包含 6 个整数 nn、P1P_1、P2P_2、P3P_3、T1T_1、T2T_2(满足 1 ≤ n ≤ 1001 ≤ n ≤ 100,0 ≤ P1, P2, P3 ≤ 1000 ≤ P_1, P_2, P_3 ≤ 100,1 ≤ T1, T2 ≤ 601 ≤ T_1, T_2 ≤ 60)。接下来的 nn 行描述了 Tom 的工作安排。其中第 ii 行包含两个以空格分隔的整数 lil_i 和 rir_i(满足 0 ≤ li < ri ≤ 14400 ≤ l_i < r_i ≤ 1440,且对所有 i < ni < n 有 ri < li+1r_i < l_{i+1}),分别表示第 ii 段工作时段的起始时刻和结束时刻。

输出格式

Output the answer to the problem.

输出问题的答案。

输入输出样例

  • 输入#1

    1 3 2 1 5 10
    0 10

    输出#1

    30
  • 输入#2

    2 8 4 2 5 10
    20 30
    50 100

    输出#2

    570

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

首页