QOJ.ac

QOJ

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

#21272. Phiếu giảm giá bò

Statistics

Farmer John cần bò mới! Có $N$ con bán, $1 \le N \le 50,000$, và FJ không được vượt ngân sách $M$, $1 \le M \le 10^{14}$. Bò $i$ giá $P_{i}$, $1 \le P_{i} \le 10^9$. Ông có $K$ phiếu, $1 \le K \le N$, dùng một phiếu cho $i$ thì giá là $C_{i}$, $1 \le C_{i} \le P_{i}$. Mỗi con chỉ một phiếu.

FJ mua tối đa bao nhiêu bò?

Dữ liệu vào

  • Dòng $1$: số nguyên $N$, $K$, $M$ cách nhau bằng dấu cách.

  • Dòng $2..N+1$: dòng $i+1$ có số nguyên $P_{i}$, $C_{i}$.

Dữ liệu ra

  • Dòng $1$: một số nguyên, số bò tối đa mua được.

Ví dụ

Dữ liệu vào 1

4 1 7
3 2
2 2
8 1
4 3

Dữ liệu ra 1

3

Ghi chú

FJ có $4$ bò, $1$ phiếu và ngân sách $7$.

Dùng phiếu cho $3$, mua $1$, $2$, $3$ với phí $3 + 2 + 1 = 6$.

Tác giả bài toán: Neal Wu và 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.