Saleh127

CF 1445A

Nov 1st, 2020
64
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);cout.tie(0);
  9.  
  10. test
  11. {
  12.  
  13. int a[1000],b[1000],c,d,e,i,j,k,l=0,n;
  14. cin>>n>>c;
  15. for(i=0;i<n;i++)
  16. {
  17. cin>>a[i];
  18. }
  19. for(i=0;i<n;i++)
  20. {
  21. cin>>b[i];
  22. }
  23. sort(a,a+n);
  24. sort(b,b+n,greater<int>());
  25. for(i=0;i<n;i++)
  26. {
  27. if(a[i]+b[i]>c)
  28. {
  29. cout<<"No"<<endl;
  30. l=1;
  31. break;
  32. }
  33. }
  34.  
  35. if(!l) cout<<"Yes"<<endl;
  36. }
  37.  
  38.  
  39. return 0;
  40. }
  41.  
RAW Paste Data Copied