#include<bits/stdc++.h>
using namespace std;
int n;
pair<int,int> v[300005];
map<int,int> frx;
map<int,int> fry;
signed main()
{
ios_base::sync_with_stdio(0);cin.tie(0);
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>v[i].first>>v[i].second;
frx[v[i].first]++;
fry[v[i].second]++;
}
long long cnt=0;
for(int i=1;i<=n;i++)
{
cnt += 1LL*(frx[v[i].first]-1)*(fry[v[i].second]-1);
}
cout<<cnt;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
600 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 |
364 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
348 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 |
1484 KB |
Output is correct |
15 |
Correct |
85 ms |
7764 KB |
Output is correct |
16 |
Correct |
88 ms |
7976 KB |
Output is correct |
17 |
Correct |
79 ms |
7580 KB |
Output is correct |
18 |
Correct |
80 ms |
7504 KB |
Output is correct |
19 |
Correct |
230 ms |
11860 KB |
Output is correct |
20 |
Correct |
156 ms |
10044 KB |
Output is correct |
21 |
Correct |
232 ms |
12136 KB |
Output is correct |
22 |
Correct |
239 ms |
12300 KB |
Output is correct |