#include<bits/stdc++.h>
#define ff first
#define ss second
using namespace std;
int n;
int x[300005],y[300005];
map<int,int> mx,my;
int main(){
cin >> n;
for(int i=1;i<=n;i++) {
cin >> x[i] >> y[i];
mx[x[i]]++;
my[y[i]]++;
}
int res=0;
for(int i=1;i<=n;i++){
res+=(mx[x[i]]-1)*(my[y[i]]-1);
}
cout << res << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
380 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
3 ms |
376 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
4 ms |
376 KB |
Output is correct |
12 |
Correct |
19 ms |
1016 KB |
Output is correct |
13 |
Correct |
22 ms |
1016 KB |
Output is correct |
14 |
Correct |
27 ms |
1400 KB |
Output is correct |
15 |
Correct |
285 ms |
6204 KB |
Output is correct |
16 |
Correct |
317 ms |
6520 KB |
Output is correct |
17 |
Correct |
287 ms |
6176 KB |
Output is correct |
18 |
Correct |
282 ms |
6136 KB |
Output is correct |
19 |
Correct |
844 ms |
11560 KB |
Output is correct |
20 |
Correct |
585 ms |
9372 KB |
Output is correct |
21 |
Correct |
900 ms |
12412 KB |
Output is correct |
22 |
Correct |
886 ms |
12508 KB |
Output is correct |