The problem name is ‘airport management’. In this code , I am not able to understand how the last for loop. For vector{1,1,2,2,2,3} it is supposed to give c=1,

because according to the condition , the last two elements(i.e., 2 and 3 are not same).

but still it is giving c=3. I am not able to understand this.

include

include

include

using namespace std;

int main() {

// your code goes here

int t;

cin>>t;

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

int n;

cin>>n;

int a[n];

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

cin>>a[j];

}

cout<<endl;

int d[n];

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

cin>>d[j];

}

std::vector v(2*n , 0);
for(int j=0;j<n;j++){
v[j] = a[j];
v[j+n] = d[j];
}
sort(v.begin(),v.end());
int count = 1;
int c = 1;
for(int j=1;j<2*n;j++){

if(v[j] == v[j-1]){

c++;

}

else{

c = 1;

}

if(c>count){

count = c;

}

}

cout<<count;

}

return 0;

}