#include <bits/stdc++.h>
using namespace std;
map<int, int> x, y;
int xx[300001], yy[300001];
int main(){
int n;
cin>>n;
for(int i = 1; i <= n; i++){
cin>>xx[i]>>yy[i];
x[xx[i]]++;
y[yy[i]]++;
}
long long s = 0;
for(int i = 1; i <= n; i++){
s += (long long)(x[xx[i]] - 1) * (y[yy[i]] - 1);
}
cout<<s;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
416 KB |
Output is correct |
4 |
Correct |
2 ms |
424 KB |
Output is correct |
5 |
Correct |
2 ms |
532 KB |
Output is correct |
6 |
Correct |
2 ms |
540 KB |
Output is correct |
7 |
Correct |
2 ms |
800 KB |
Output is correct |
8 |
Correct |
2 ms |
800 KB |
Output is correct |
9 |
Correct |
3 ms |
800 KB |
Output is correct |
10 |
Correct |
3 ms |
828 KB |
Output is correct |
11 |
Correct |
3 ms |
852 KB |
Output is correct |
12 |
Correct |
17 ms |
1560 KB |
Output is correct |
13 |
Correct |
18 ms |
1692 KB |
Output is correct |
14 |
Correct |
24 ms |
2416 KB |
Output is correct |
15 |
Correct |
252 ms |
7240 KB |
Output is correct |
16 |
Correct |
265 ms |
9792 KB |
Output is correct |
17 |
Correct |
292 ms |
11864 KB |
Output is correct |
18 |
Correct |
276 ms |
14076 KB |
Output is correct |
19 |
Correct |
775 ms |
21772 KB |
Output is correct |
20 |
Correct |
534 ms |
25568 KB |
Output is correct |
21 |
Correct |
854 ms |
32532 KB |
Output is correct |
22 |
Correct |
754 ms |
39120 KB |
Output is correct |