# Help me in solving ARRAY problem

### My issue

There’s issue in submission

### My code

``````#include <iostream>
using namespace std;

int main() {
// your code goes here

int T;
cin>>T;

int n,k;

while(T--)
{
int A[n];
int B[n];
cin>>n;
cin>>k;
for(int i=0;i<n;i++){
cin>>A[i];
cin>>B[i];
}

for(int i=0;i<n;i++)
{

if(A[i]+B[i]>=k)
{
cout<<"YES";
}
else
{
cout<<"No";
}
}

}
return 0;
}

``````

Problem Link: ARRAY Problem - CodeChef

@mitaoe723
your logic is not right.
plzz refer the following solution for better understanding of the logic.

``````#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
int t;
cin >> t;

while (t--) {
int n, k;
cin >> n >> k;
vector<int> a(n);
vector<int> b(n);

for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n; i++) {
cin >> b[i];
}

sort(a.begin(), a.end());  // Sort array A in ascending order
sort(b.rbegin(), b.rend());  // Sort array B in descending order

bool possible = true;  // Assume it's possible unless proven otherwise

for (int i = 0; i < n; i++) {
if (a[i] + b[i] < k) {
possible = false;
break;  // No need to continue checking once the condition is not met
}
}

if (possible) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
return 0;
}``````