why my solution giving wrong answer, i have checked some accepted code algo seems to correct. here my code.
main()
{
ll T;
cin>>T;
while(T–) {
ll n,x,y;
bool posx[100001],negx[100001];
bool posy[100001],negy[100001];
memset(posx,0,sizeof(posx));
memset(negx,0,sizeof(negx));
memset(posy,0,sizeof(posy));
memset(negy,0,sizeof(negy));
cin>>n;
ll resx,resy;
resx=0;
resy=0;
for(ll i=0;i<n;i++){
cin>>x>>y;
if(x<0){
x=x*(-1);
if(negx[x]==0){
resx++;
negx[x]=1;
}
}
if(y<0){
y=y*(-1);
if(negy[y]==0){
resy++;
negy[y]=1;
}
}
if(x>=0){
if(posx[x]==0){
resx++;
posx[x]=1;
}
}
if(y>=0){
if(posy[y]==0){
resy++;
posy[y]=1;
}
}
}
if(n==0){
cout<<"0"<<endl;//I have also test code when n=0 and print 1//it was also giving wrong answer
}
else{
ll res=(resx+1)*(resy+1);
cout<<res<<endl;
}
}
}