PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GD0000049. Xếp hàng chụp ảnh (Mark the Photographer)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Xếp hàng chụp ảnh (Mark the Photographer)
Mark the Photographer
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
There are people of heights . Arrange them into front and back rows of people, so that each back-row person is at least taller than the front-row person in the same column. Determine feasibility.
Input
Line 1: . Line 2: heights .
Output
Print YES if feasible, otherwise NO.
Subtasks
- Subtask 1 (20 points): ; ; for every .
- Subtask 2 (30 points): ; ; for every .
- Subtask 3 (50 points): ; ; for every .
Examples
Input
3 6
1 3 9 10 12 16
Output
YES
Explanation
Front row and back row give differences , all at least 6; hence YES.