QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#21272. Kuhgutscheine

Statistics

Farmer John braucht neue Kühe! Es gibt $N$ zum Verkauf, $1 \le N \le 50,000$. FJ darf sein Budget $M$, $1 \le M \le 10^{14}$, nicht überschreiten. Kuh $i$ kostet $P_{i}$, $1 \le P_{i} \le 10^9$. Er hat $K$ Gutscheine, $1 \le K \le N$, und ein Gutschein für Kuh $i$ ersetzt den Preis durch $C_{i}$, $1 \le C_{i} \le P_{i}$. Höchstens ein Gutschein pro Kuh.

Wie viele Kühe kann FJ höchstens kaufen?

Eingabe

  • Zeile $1$: durch Leerzeichen getrennte ganze Zahlen $N$, $K$, $M$.

  • Zeilen $2..N+1$: Zeile $i+1$ enthält ganze Zahlen $P_{i}$ und $C_{i}$.

Ausgabe

  • Zeile $1$: eine ganze Zahl, die maximal bezahlbare Anzahl Kühe.

Beispiele

Eingabe 1

4 1 7
3 2
2 2
8 1
4 3

Ausgabe 1

3

Hinweis

FJ hat $4$ Kühe, $1$ Gutschein und Budget $7$.

Er verwendet den Gutschein für $3$ und kauft $1$, $2$, $3$ für $3 + 2 + 1 = 6$.

Aufgabenautoren: Neal Wu und Mark Gordon, 2012

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.