All test cases are not passed

Only one test case is passed .

Hey
Can you post your code?

#include<bits/stdc++.h>
using namespace std;
int main() {
int n,j=0;
cin>>n;
int a[2n];
int b[n];
for(int i=0;i<n;i++){
cin>>a[i];
a[j]=a[i];
j++;
}
for(int i=0;i<n;i++){
cin>>b[i];
a[i]=b[i];
j++;
}
sort(a,a+2
n);
int d=(2*n-1)/2;
cout<<a[d]<<endl;
return 0;
}

Hey
when no of elements is even, the median is the average of the two numbers lying in the middle.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.