#include <bits/stdc++.h>
#define Fname "triangles"
using namespace std;
const int MaxN = 3e5 + 17, INF = 1e9 + 17, Mod = 1e9 + 7;
map < int, int > mx;
map < int, int > my;
int x[MaxN], y[MaxN], n;
long long Sum;
int main ()
{
#ifdef Elibay
freopen (".in", "r", stdin);
#endif
scanf ("%d", &n);
for (int i = 1; i <= n; ++ i)
scanf ("%d%d", &x[i], &y[i]), mx[x[i]] ++, my[y[i]] ++;
for (int i = 1; i <= n; ++ i)
Sum += (mx[x[i]] - 1) * (my[y[i]] - 1);
printf ("%lld", Sum);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
4068 KB |
Output is correct |
2 |
Correct |
0 ms |
4068 KB |
Output is correct |
3 |
Correct |
0 ms |
4068 KB |
Output is correct |
4 |
Correct |
0 ms |
4068 KB |
Output is correct |
5 |
Correct |
0 ms |
4068 KB |
Output is correct |
6 |
Correct |
0 ms |
4068 KB |
Output is correct |
7 |
Correct |
0 ms |
4068 KB |
Output is correct |
8 |
Correct |
1 ms |
4068 KB |
Output is correct |
9 |
Correct |
0 ms |
4068 KB |
Output is correct |
10 |
Correct |
0 ms |
4068 KB |
Output is correct |
11 |
Correct |
0 ms |
4068 KB |
Output is correct |
12 |
Correct |
10 ms |
4464 KB |
Output is correct |
13 |
Correct |
9 ms |
4464 KB |
Output is correct |
14 |
Correct |
15 ms |
4860 KB |
Output is correct |
15 |
Correct |
141 ms |
6972 KB |
Output is correct |
16 |
Correct |
113 ms |
6972 KB |
Output is correct |
17 |
Correct |
132 ms |
6972 KB |
Output is correct |
18 |
Correct |
122 ms |
6972 KB |
Output is correct |
19 |
Correct |
428 ms |
7104 KB |
Output is correct |
20 |
Correct |
253 ms |
7104 KB |
Output is correct |
21 |
Correct |
440 ms |
7104 KB |
Output is correct |
22 |
Correct |
456 ms |
7104 KB |
Output is correct |