Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t,x,y;
map<int,int>m1,m2;
long int n,i;
cin>>t;
while(t--){
cin>>n;
for(i=0;i<n;i++){
cin>>x>>y;
m1[x]++;
m2[y]++;
}
int ans=min(m1.size(),m2.size());
cout<<ans<<endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.