#include<bits/stdc++.h>
using namespace std;
struct point
{
int x,y;
};
point p[300000];
//int x[100000],y[100000];
map<int,int> y,x;
int n;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>n;
for(int i=0;i<n;i++)
{
cin>>p[i].x>>p[i].y;
x[p[i].x]++;
y[p[i].y]++;
}
int ans=0;
for(int i=0;i<n;i++)
{
ans+=(x[p[i].x]-1)*(y[p[i].y]-1);
}
cout<<ans<<"\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 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 |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
500 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
5 ms |
1116 KB |
Output is correct |
13 |
Correct |
5 ms |
1116 KB |
Output is correct |
14 |
Correct |
8 ms |
1372 KB |
Output is correct |
15 |
Correct |
80 ms |
6924 KB |
Output is correct |
16 |
Correct |
87 ms |
6740 KB |
Output is correct |
17 |
Correct |
80 ms |
6736 KB |
Output is correct |
18 |
Correct |
87 ms |
7068 KB |
Output is correct |
19 |
Correct |
213 ms |
9340 KB |
Output is correct |
20 |
Correct |
153 ms |
8552 KB |
Output is correct |
21 |
Correct |
239 ms |
10064 KB |
Output is correct |
22 |
Correct |
233 ms |
9960 KB |
Output is correct |