#include<bits/stdc++.h>
using namespace std;
const int MAXN=300005;
int x[MAXN],y[MAXN];
map<int,int> mpx,mpy;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n;
cin >> n;
for(int i=1;i<=n;i++){
cin >> x[i] >> y[i];
mpx[x[i]]++;
mpy[y[i]]++;
}
long long ans=0;
for(int i=1;i<=n;i++){
ans=ans+1LL*(mpx[x[i]]-1)*(mpy[y[i]]-1);
}
cout << ans << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
512 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
492 KB |
Output is correct |
11 |
Correct |
1 ms |
364 KB |
Output is correct |
12 |
Correct |
7 ms |
1004 KB |
Output is correct |
13 |
Correct |
7 ms |
1132 KB |
Output is correct |
14 |
Correct |
12 ms |
1388 KB |
Output is correct |
15 |
Correct |
182 ms |
6508 KB |
Output is correct |
16 |
Correct |
142 ms |
6508 KB |
Output is correct |
17 |
Correct |
125 ms |
6252 KB |
Output is correct |
18 |
Correct |
127 ms |
6252 KB |
Output is correct |
19 |
Correct |
442 ms |
11812 KB |
Output is correct |
20 |
Correct |
264 ms |
9324 KB |
Output is correct |
21 |
Correct |
465 ms |
12268 KB |
Output is correct |
22 |
Correct |
413 ms |
12372 KB |
Output is correct |