PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GD0000115. Cuộc đua điểm số (Pursuit)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Cuộc đua điểm số (Pursuit)
Pursuit
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
You and Ilya have completed rounds, each scoring from to . With rounds in total, the final score sums the top round scores. You may add rounds, in which you could score and Ilya . Find the minimum additional rounds for your total to be at least Ilya's.
Input
Line 1 contains . Line 2 contains your scores . Line 3 contains Ilya's scores .
Output
Print the fewest extra rounds required, possibly zero.
Subtasks
- Subtask 1 (20 points): ; for every .
- Subtask 2 (30 points): ; for every .
- Subtask 3 (50 points): ; for every .
Examples
Input
1
0
100
Output
1
Explanation
Initially you have versus Ilya's . Adding one round with scores versus makes both total scores ; therefore one additional round suffices.