GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Friday, 15 July 2022

[Solution] Mark the Photographer Codeforces Solution



A. Mark the Photographer

time limit per test
memory limit per test
input
output
standard output standard input256 megabytes1 second

Mark is asked to take a group photo of 2n people. The i-th person has height hi units.

To do so, he ordered these people into two rows, the front row and the back row, each consisting of n people. However, to ensure that everyone is seen properly, the j-th person of the back row must be at least x units taller than the j-th person of the front row for each j between 1 and n, inclusive.

mohit

Help Mark determine if this is


Input

The first line contains one integer t (1t100) — the number of test cases. Each test case consists of two lines.

The first line of each test case contains two positive integers n and x (1n1001x103)

Mark and the Online Exam Codeforces Solution

Mark and Professor Koro Codeforces Solution

Mark and Lightbulbs Codeforces Solution

Mark and His Unfinished Essay Codeforces Solution

Mark the Dust Sweeper Codeforces Solution

Mark the Photographer Codeforces Solution

 — the number of people in each row and the minimum difference Mark wants.

The second line of each test case contains 2n positive integers h1,h2,,h2n (1hi103) — the height of each person in units.

Note that the sum of n over all test cases is not bounded.

Output

For each test case, print a single line containing "YES" if Mark could arrange people satisfying his condition and "NO" otherwise.

You may print each letter in any case (for example, YESYesyesyEs will all be recognized as positive answers).

No comments:

Post a Comment