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

Bài tập thuộc lộ trình

1 lộ trình

Xếp hàng chụp ảnh (Mark the Photographer)

Mark the Photographer

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

There are 2n2n people of heights hih_i. Arrange them into front and back rows of nn people, so that each back-row person is at least xx taller than the front-row person in the same column. Determine feasibility.

Input

Line 1: n,xn,x. Line 2: 2n2n heights hih_i.

Output

Print YES if feasible, otherwise NO.

Subtasks

  • Subtask 1 (20 points): 1≤n≤31\le n\le 3; 1≤x≤10001\le x\le 1000; 1≤hi≤10001\le h_i\le 1000 for every ii.
  • Subtask 2 (30 points): 1≤n≤201\le n\le 20; 1≤x≤10001\le x\le 1000; 1≤hi≤10001\le h_i\le 1000 for every ii.
  • Subtask 3 (50 points): 1≤n≤1001\le n\le 100; 1≤x≤10001\le x\le 1000; 1≤hi≤10001\le h_i\le 1000 for every ii.

Examples

Input

3 6
1 3 9 10 12 16

Output

YES

Explanation

Front row 1,3,101,3,10 and back row 9,12,169,12,16 give differences 8,9,68,9,6, all at least 6; hence YES.