#include<stdio.h>
#include<algorithm>
#include<map>
using namespace std;
map<int, int>Map1, Map2;
int n, w[300010][2], i;
long long R;
int main()
{
scanf("%d", &n);
for (i = 0; i < n; i++){
scanf("%d%d", &w[i][0], &w[i][1]);
Map1[w[i][0]]++, Map2[w[i][1]]++;
}
for (i = 0; i < n; i++){
R = R +(long long)(Map1[w[i][0]] - 1)*(Map2[w[i][1]] - 1);
}
printf("%lld\n", R);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
3552 KB |
Output is correct |
2 |
Correct |
0 ms |
3552 KB |
Output is correct |
3 |
Correct |
0 ms |
3552 KB |
Output is correct |
4 |
Correct |
0 ms |
3552 KB |
Output is correct |
5 |
Correct |
0 ms |
3552 KB |
Output is correct |
6 |
Correct |
0 ms |
3552 KB |
Output is correct |
7 |
Correct |
0 ms |
3552 KB |
Output is correct |
8 |
Correct |
0 ms |
3552 KB |
Output is correct |
9 |
Correct |
0 ms |
3552 KB |
Output is correct |
10 |
Correct |
0 ms |
3552 KB |
Output is correct |
11 |
Correct |
0 ms |
3552 KB |
Output is correct |
12 |
Correct |
8 ms |
3948 KB |
Output is correct |
13 |
Correct |
8 ms |
3948 KB |
Output is correct |
14 |
Correct |
8 ms |
4344 KB |
Output is correct |
15 |
Correct |
156 ms |
6456 KB |
Output is correct |
16 |
Correct |
176 ms |
6456 KB |
Output is correct |
17 |
Correct |
164 ms |
6456 KB |
Output is correct |
18 |
Correct |
156 ms |
6456 KB |
Output is correct |
19 |
Correct |
468 ms |
6588 KB |
Output is correct |
20 |
Correct |
308 ms |
6588 KB |
Output is correct |
21 |
Correct |
476 ms |
6588 KB |
Output is correct |
22 |
Correct |
468 ms |
6588 KB |
Output is correct |