Logo
(追記) (追記ここまで)

21101번 - GPA 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB108424138.318%

문제

In this semester, Alice took $n$ courses. Now, she has finished all the final exams. And she will get her grades in the following $n$ days.

On the $i$-th day, Alice will know her grade $A_i$ of the $i$-th course. If $A_i$ is strictly less than the average grade of the first $i - 1$ courses, Alice will be sad on that day.

Now Bob is hacking into the university's database. Bob can choose a set $S$ of courses ($S$ can be empty). And then for each course $i$ in $S,ドル he can change Alice's grade from $A_i$ to $B_i$.

Bob wants to minimize the number of days when Alice will be sad. Now you need to help him to decide which courses' grades he should modify.

Note that Alice will always be happy on the first day.

입력

The first line contains a single integer $n$ (1ドル \le n \le 4000$).

Then $n$ lines follow. The $i$-th of these lines contains two integers, $A_i$ and $B_i$ (0ドル \le A_i, B_i \le 400$).

출력

Output the minimum number of days when Alice will be sad.

제한

예제 입력 1

4
1 2
2 3
1 2
1 1

예제 출력 1

1

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2021 > Day 6: PKU Contest 2 G번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /