Advertisement
maycod23

Parctise_Contest_2_Q_1

Mar 6th, 2022
928
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     int t; cin >> t;
  6.     while (t--)
  7.     {
  8.         int n, d; cin >> n >> d;
  9.         vector<int> a(n);
  10.         for (int i = 0; i < n; i++) cin >> a[i];
  11.         sort(a.begin(), a.end());
  12.         if (a[0] + a[1] <= d || a[n - 1] <= d) cout << "YES" << endl;
  13.         else cout << "NO" << endl;
  14.     }
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement