#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int g[n],w[n],fg[n],fw[n],sg[n],sw[n];
for(int i=0;i<n;i++){
cin>>g[i];
fg[i]=g[i];
}
for(int i=0;i<n;i++){
cin>>w[i];
fw[i]=w[i];
}
map <int,int> mp;
for(int i=0;i<n;i++){
mp.insert({g[i],w[i]});
}
int max=0;
int count=0;
for(auto it=mp.rbegin();it!=mp.rend();it++){
if(max<it->second){
count++;
max=it->second;
}
}
cout<<count<<endl;
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: