#include <bits/stdc++.h>
using namespace std ;
const int MAX = 3e5 + 10 ;
int arr[MAX] ;
int n ;
int X[MAX] , Y[MAX] ;
map<int , int>mpx , mpy ;
int main()
{
ios_base::sync_with_stdio(0) ;
cin.tie(0) ;
cin>>n ;
for(int i = 0 ; i < n ; ++i)
cin>>X[i]>>Y[i] ;
for(int i = 0 ; i < n ; ++i)
mpx[X[i]]++ , mpy[Y[i]]++ ;
long long ans = 0 ;
for(int i = 0 ; i < n ; ++i)
ans += 1ll * (mpx[X[i]]-1ll) * (mpy[Y[i]]-1ll) ;
return cout<<ans<<"\n" , 0 ;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
328 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
6 ms |
980 KB |
Output is correct |
13 |
Correct |
6 ms |
980 KB |
Output is correct |
14 |
Correct |
10 ms |
1364 KB |
Output is correct |
15 |
Correct |
94 ms |
6084 KB |
Output is correct |
16 |
Correct |
106 ms |
6428 KB |
Output is correct |
17 |
Correct |
99 ms |
6164 KB |
Output is correct |
18 |
Correct |
91 ms |
6160 KB |
Output is correct |
19 |
Correct |
246 ms |
11636 KB |
Output is correct |
20 |
Correct |
179 ms |
9208 KB |
Output is correct |
21 |
Correct |
267 ms |
12108 KB |
Output is correct |
22 |
Correct |
268 ms |
12108 KB |
Output is correct |