#include<iostream>
#include<bits/stdc++.h>
#define MAXN 300010
using namespace std;
map<int,int> row,col;
pair<int,int> p[MAXN];
int main()
{
int n;
long long ans=0;
ios_base::sync_with_stdio(false);
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>p[i].first>>p[i].second;
row[p[i].first]++;
col[p[i].second]++;
}
for(int i=1;i<=n;i++)
{
long long l=row[p[i].first]-1;
long long r=col[p[i].second]-1;
l=l*r;
ans+=l;
}
cout<<ans<<"\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
7 ms |
860 KB |
Output is correct |
13 |
Correct |
4 ms |
856 KB |
Output is correct |
14 |
Correct |
7 ms |
1116 KB |
Output is correct |
15 |
Correct |
79 ms |
5592 KB |
Output is correct |
16 |
Correct |
103 ms |
5680 KB |
Output is correct |
17 |
Correct |
81 ms |
5592 KB |
Output is correct |
18 |
Correct |
84 ms |
5588 KB |
Output is correct |
19 |
Correct |
216 ms |
5748 KB |
Output is correct |
20 |
Correct |
169 ms |
5732 KB |
Output is correct |
21 |
Correct |
235 ms |
6108 KB |
Output is correct |
22 |
Correct |
248 ms |
5860 KB |
Output is correct |