Median of sorted arrays

#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
vector arr1(n);
vector arr2(n);
vector arr3(2*n);
for(int i=0;i<n;i++)
{
int temp;
cin>>temp;
arr1.push_back(temp);
}
for(int i=0;i<n;i++)
{
int t;
cin>>t;
arr2.push_back(t);
}
sort(arr1.begin(), arr1.end());
sort(arr2.begin(), arr2.end());

merge(arr1.begin(), arr1.end(), arr2.begin(), arr2.end(), arr3.begin()); 
int res=(2*n)/2;
cout<<arr3[res];

}

why it is not working

@rupeshjha909
Hello rupesh,
please share ur code using coding blocks ide

@rupeshjha909
mistakes
a) vector a(n) will create a vector of size n and to insert at index i of this vector use
a[i] = something;
u are using push_back which is not correct.
b) output arr3[res-1] and not arr3[res]