QOJ.ac

QOJ

実行時間制限: 2 s メモリ制限: 256 MB 満点: 100

#21362. Goldilocks und die N Kühe

統計

Vielleicht kennst du Goldilocks und die drei Bären. Später wurde sie Bäuerin und hat $N$ Kühe ($(1 \le N \le 20,000)$) im Stall, die temperaturempfindlich sind.

Kuh $i$ mag $A(i)..B(i)$ ($0 \le A(i) \le B(i) \le 10^9$). Bei $T < A(i)$ ist es zu kalt und sie gibt $X$; bei $T$ darin ($A(i) \le T \le B(i)$) angenehm und $Y$; bei $T > B(i)$ zu heiß und $Z$ Einheiten Milch. $Y$ ist immer größer als $X$ und $Z$.

Berechne aus $X$, $Y$, $Z$ und den Bereichen die maximale Milch bei optimalem Thermostat. $X$, $Y$, $Z$ sind ganze Zahlen in 0..1000, die Temperatur darf jede ganze Zahl sein.

Eingabe

  • Zeile 1: vier durch Leerzeichen getrennte ganze Zahlen $N$ $X$ $Y$ $Z$.
  • Zeilen $2..1+N$: Zeile $1+i$ enthält durch Leerzeichen getrennte ganze Zahlen $A(i)$ und $B(i)$.

Ausgabe

  • Zeile 1: maximale Milch bei optimaler Temperatur.

Beispiele

Eingabe 1

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

Ausgabe 1

31

Hinweis

Vier Bereiche: 5..8, 3..4, 13..20, 7..10. Kalt gibt 7, angenehm 9, heiß 6 Einheiten.

Bei 7 oder 8 fühlen #1 und #4 sich wohl, #2 ist zu heiß, #3 zu kalt, insgesamt 31.

Teilaufgaben

Teilpunkte: Von 10 Tests haben 1..4 überall $B(i) \le 100$, und in 1..6 ist $N$ höchstens 1000.

Aufgabenautor: 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.