blob: 15c4e291ac732e8023ccab939a97aa494fc6151a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tt;
cin >> tt;
while (tt--) {
int n, y;
cin >> n >> y;
vector<int> v(2 * n);
int ans = 0;
for (int &x : v)
cin >> x;
sort(v.begin(), v.end());
for (int i = 0; i < n; i++) {
int x = v[i];
int z = v[i + n];
if (z - x >= y) {
ans++;
}
}
if (ans == n) {
cout << "YES" << '\n';
} else {
cout << "NO" << '\n';
}
}
}
|