#include <iostream>
#include <unordered_map>
#define MAX_N 300000
using namespace std;
int x[MAX_N], y[MAX_N];
unordered_map <int, int> mpx, mpy;
int main() {
int n, i;
long long nrTri;
cin >> n;
for ( i = 0; i < n; i++ ) {
cin >> x[i] >> y[i];
mpx[x[i]]++;
mpy[y[i]]++;
}
nrTri = 0;
for ( i = 0; i < n; i++ )
nrTri += ((long long)mpx[x[i]] - 1) * (mpy[y[i]] - 1);
cout << nrTri;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
300 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
304 KB |
Output is correct |
11 |
Correct |
2 ms |
332 KB |
Output is correct |
12 |
Correct |
9 ms |
844 KB |
Output is correct |
13 |
Correct |
12 ms |
1080 KB |
Output is correct |
14 |
Correct |
13 ms |
1220 KB |
Output is correct |
15 |
Correct |
98 ms |
5804 KB |
Output is correct |
16 |
Correct |
109 ms |
6136 KB |
Output is correct |
17 |
Correct |
95 ms |
5800 KB |
Output is correct |
18 |
Correct |
96 ms |
5832 KB |
Output is correct |
19 |
Correct |
275 ms |
11356 KB |
Output is correct |
20 |
Correct |
188 ms |
8820 KB |
Output is correct |
21 |
Correct |
284 ms |
11724 KB |
Output is correct |
22 |
Correct |
296 ms |
11772 KB |
Output is correct |