QOJ.ac

QOJ

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

#976. GPA

統計

Trong học kỳ này, Alice đã tham gia $n$ môn học. Hiện tại, cô ấy đã hoàn thành tất cả các kỳ thi cuối kỳ và sẽ nhận được điểm số trong $n$ ngày tiếp theo.

Vào ngày thứ $i$, Alice sẽ biết điểm số $A_i$ của môn học thứ $i$. Nếu $A_i$ nhỏ hơn điểm trung bình của $i - 1$ môn học đầu tiên, Alice sẽ buồn vào ngày đó.

Bob đang xâm nhập vào cơ sở dữ liệu của trường đại học. Bob có thể chọn một tập hợp $S$ các môn học ($S$ có thể là tập rỗng). Sau đó, với mỗi môn học $i$ trong $S$, anh ấy có thể thay đổi điểm số của Alice từ $A_i$ thành $B_i$.

Bob muốn giảm thiểu số ngày mà Alice cảm thấy buồn. Bạn cần giúp anh ấy quyết định nên thay đổi điểm số của những môn học nào.

Lưu ý rằng Alice sẽ luôn vui vẻ vào ngày đầu tiên.

Dữ liệu vào

Dòng đầu tiên chứa một số nguyên duy nhất $n$ ($1 \le n \le 4000$).

$n$ dòng tiếp theo, dòng thứ $i$ chứa hai số nguyên $A_i$ và $B_i$ ($0 \le A_i, B_i \le 400$).

Dữ liệu ra

In ra số ngày tối thiểu mà Alice sẽ cảm thấy buồn.

Ví dụ

Dữ liệu vào 1

4
1 2
2 3
1 2
1 1

Dữ liệu ra 1

1

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.