Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int t; cin >> t;
- while (t--)
- {
- int n, d; cin >> n >> d;
- vector<int> a(n);
- for (int i = 0; i < n; i++) cin >> a[i];
- sort(a.begin(), a.end());
- if (a[0] + a[1] <= d || a[n - 1] <= d) cout << "YES" << endl;
- else cout << "NO" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement