PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GD0000137. Phân chia nho cho ba người (Got Any Grapes?)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Phân chia nho cho ba người (Got Any Grapes?)
Got Any Grapes?
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
There are green, purple, and black grapes. Andrew needs at least grapes and eats only green; Dmitry needs at least and eats green or purple; Michal needs at least and eats any color. Each grape may be given to at most one person. Decide whether everyone can be satisfied.
Input
The first line contains . The second line contains .
Output
Print YES if possible; otherwise NO.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
1 6 2
4 3 3
Output
YES
Explanation
Andrew receives one green grape; Dmitry gets the remaining three green and three purple grapes; Michal takes two black grapes. Everyone is satisfied.