#include <iostream>
#include <map>
#include <algorithm>
#define x first
#define y second
using namespace std;
const int nmax=300005;
map<int,int> X,Y;
pair<int,int> v[nmax];
int n,i;
long long ans;
int main()
{
cin>>n;
for(i=1;i<=n;i++)
cin>>v[i].x>>v[i].y;
for(int cc=0;cc<4;cc++)
{
for(i=1;i<=n;i++)
{
if(cc>0)
{
v[i].x*=-1;
}
else
{
if((cc&2)!=((cc-1)&2))
v[i].y*=-1;
}
}
sort(v+1,v+n+1);
for(i=n;i>=1;i--)
{
ans+=1LL*X[v[i].x]*Y[v[i].y];
X[v[i].x]++,Y[v[i].y]++;
}
X.clear();Y.clear();
}
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |