1 solutions

  • 0
    @ 2025-12-23 22:22:16
    #include<bits/stdc++.h>
    using namespace std;
    int n,x,y,ans;
    set<pair<int,int> >sp; 
    int main()
    {
    	cin>>n;
    	for(int i=0;i<n;i++)
    	{
    		cin>>x>>y;
    		sp.insert({x,y}); 
    	}
    	for(auto a:sp)
    	{
    		for(auto b:sp)
    		{
    			if(a.first!=b.first&&a.second!=b.second)
    			{
    				if(sp.find({a.first,b.second})!=sp.end()&&sp.find({b.first,a.second})!=sp.end())
    				{
    					ans++;
    				}
    			}
    		}
    	}
    	cout<<ans/4;
    	return 0;
    }
    

    Information

    ID
    2633
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    10
    Tags
    # Submissions
    5
    Accepted
    4
    Uploaded By