0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-10 08:38:49 +00:00

CF1445A Array Rearrangment

R41908028
This commit is contained in:
Baoshuo Ren 2020-11-14 22:15:30 +08:00 committed by Baoshuo Ren
parent 45a2330bb9
commit 10a13692b5
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

View File

@ -0,0 +1,35 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n, x, a[55], b[55];
bool flag = false;
cin >> n >> x;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n; i++) {
cin >> b[i];
}
sort(a, a + n);
sort(b, b + n);
reverse(b, b + n);
for (int i = 0; i < n; i++) {
if (a[i] + b[i] > x) {
flag = true;
}
}
if (flag) {
cout << "No" << endl;
}
else {
cout << "Yes" << endl;
}
}
return 0;
}