-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path680A.cpp
More file actions
37 lines (36 loc) · 691 Bytes
/
680A.cpp
File metadata and controls
37 lines (36 loc) · 691 Bytes
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
32
33
34
35
36
37
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
int n, x;
cin >> n >> x;
int arr[n],arr1[n];
for(int i = 0; i < n; i++)
{
cin >> arr[i];
}
for(int i = 0; i < n; i++){
cin >> arr1[i];
}
sort(arr,arr+n);
sort(arr1,arr1+n);
bool no = false;
for(int i = 0; i < n; i++){
if(arr[i]+arr1[n-1-i] > x){
no = true;
break;
}
}
if(!no){
cout << "YES\n";
}
else
{
cout << "NO\n";
}
}
}