Under construction

Still being built. Things may change

Ladder

Interview

Time limit2sMemory limit64 MB

Summary
Given n sticks that can only be shortened, decide whether two can become length x and k others length y.
Level

Medium4 of 10

Topics
Greedy, Sorting, Array, Implementation
Solved
No attempts yet

Problem

You have nn sticks of lengths d1,d2,…,dnd_1, d_2, \ldots, d_n. To build a ladder you need k+2k+2 sticks: two sticks of length xx and kk sticks of length yy. You may shorten the sticks you have, but you cannot split one stick into two. Can you make a ladder?

Input

The first line contains a single integer zz, the number of test cases. The descriptions of the test cases follow.

Each test case consists of four integers nn, kk, xx, yy (1≤n≤1051 \leq n \leq 10^5, 0≤k≤1050 \leq k \leq 10^5, 1≤x,y≤1091 \leq x, y \leq 10^9) followed by nn integers d1d_1, d2d_2, …\ldots, dnd_n (1≤di≤1091 \leq d_i \leq 10^9).

Output

For each test case, output a single line containing the word "YES" if making a ladder is possible, or "NO" otherwise.

Examples1

  1. Example 1

    Input
    2
    8 3 5 2
    1 1 1 2 3 4 5 6
    8 3 6 2
    1 1 1 2 3 4 5 6
    
    Expected output
    YES
    NO