Logo
(追記) (追記ここまで)

19179번 - Ladder 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 64 MB118612435.821%

문제

You have got $n$ sticks of lengths $d_1, d_2, \ldots, d_n$. To build a ladder, you need $k+2$ sticks: two sticks of length $x$ and $k$ sticks of length $y$. You may shorten the sticks you already have, but you cannot divide one stick into two. Can you make a ladder?

입력

The first line of the input contains a single integer $z,ドル the number of test cases. The descriptions of the test cases follow.

Each test case consists of four integers $n,ドル $k,ドル $x,ドル $y$ (1ドル \leq n \leq 10^5,ドル 0ドル \leq k \leq 10^5,ドル 1ドル \leq x, y \leq 10^9$) followed by $n$ integers $d_1,ドル $d_2,ドル $\ldots,ドル $d_n$ (1ドル \leq d_i \leq 10^9$).

출력

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

제한

예제 입력 1

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

예제 출력 1

YES
NO

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2015 > Day 6: Jagiellonian U Contest A번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /