#include<cstdio>
#include<unordered_map>
using namespace std;
unordered_map<int,int> X,Y;
int x[300001],y[300001];
int main()
{
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%d %d",&x[i],&y[i]), X[x[i]]++, Y[y[i]]++;
long long ans=0;
for(int i=1;i<=n;i++)
ans+=(X[x[i]]-1ll)*(Y[y[i]]-1);
printf("%lld",ans);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
3924 KB |
Output is correct |
2 |
Correct |
0 ms |
3924 KB |
Output is correct |
3 |
Correct |
0 ms |
3924 KB |
Output is correct |
4 |
Correct |
0 ms |
3924 KB |
Output is correct |
5 |
Correct |
0 ms |
3924 KB |
Output is correct |
6 |
Correct |
0 ms |
3924 KB |
Output is correct |
7 |
Correct |
0 ms |
3924 KB |
Output is correct |
8 |
Correct |
0 ms |
3924 KB |
Output is correct |
9 |
Correct |
0 ms |
3924 KB |
Output is correct |
10 |
Correct |
0 ms |
3924 KB |
Output is correct |
11 |
Correct |
0 ms |
3924 KB |
Output is correct |
12 |
Correct |
3 ms |
4336 KB |
Output is correct |
13 |
Correct |
6 ms |
4344 KB |
Output is correct |
14 |
Correct |
9 ms |
4628 KB |
Output is correct |
15 |
Correct |
72 ms |
7032 KB |
Output is correct |
16 |
Correct |
64 ms |
7032 KB |
Output is correct |
17 |
Correct |
58 ms |
7036 KB |
Output is correct |
18 |
Correct |
76 ms |
7032 KB |
Output is correct |
19 |
Correct |
116 ms |
7032 KB |
Output is correct |
20 |
Correct |
110 ms |
7032 KB |
Output is correct |
21 |
Correct |
203 ms |
7032 KB |
Output is correct |
22 |
Correct |
173 ms |
7032 KB |
Output is correct |