QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 256 MB مجموع النقاط: 100

#21362. Goldilocks と N 頭の牛

الإحصائيات

Goldilocks と 3 頭の熊の話をご存じかもしれません。実は彼女はその後農業を職業にし、農場の牛舎に $N$ 頭($(1 \le N \le 20,000)$)を飼っています。牛は温度に敏感です。

牛 $i$ の適温は $A(i)..B(i)$($0 \le A(i) \le B(i) \le 10^9$)です。設定が $T < A(i)$ なら寒くて乳量 $X$、範囲内の $T$($A(i) \le T \le B(i)$)なら快適で $Y$、$T > B(i)$ なら暑くて $Z$ です。$Y$ は常に $X$ と $Z$ より大きいです。

$X$、$Y$、$Z$ と各牛の適温から最適設定の最大乳量を求めてください。$X$、$Y$、$Z$ は 0..1000 の整数で、設定温度は任意の整数です。

入力

  • 1 行目:空白区切りの整数 $N$ $X$ $Y$ $Z$。
  • $2..1+N$ 行目:$1+i$ 行目は空白区切りの整数 $A(i)$ と $B(i)$ です。

出力

  • 1 行目:最適設定で得られる最大乳量。

入出力例

入力 1

4 7 9 6
5 8
3 4
13 20
7 10

出力 1

31

注記

4 頭の適温は 5..8、3..4、13..20、7..10。寒いと 7、快適だと 9、暑いと 6 単位です。

7 または 8 なら #1 と #4 は快適、#2 は暑く、#3 は寒く、合計 31 です。

小課題

部分点:10 ケース中、1..4 では全牛が $B(i) \le 100$、1..6 では $N$ が高々 1000 です。

問題作成者:Brian Dean, 2013

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.