#include <bits/stdc++.h>
using namespace std;
signed main()
{
int n;
cin >> n;
int x[400000], y[400000];
map<int, int> mp1, mp2;
for(int i = 0; i < n; i++)
{
cin >> x[i] >> y[i];
mp1[x[i]]++;
mp2[y[i]]++;
}
int k = 0;
for(int i = 0; i < n; i++)
{
k += (mp1[x[i]] - 1) * (mp2[y[i]] - 1);
}
cout << k;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
3420 KB |
Output is correct |
2 |
Correct |
3 ms |
3412 KB |
Output is correct |
3 |
Correct |
3 ms |
3408 KB |
Output is correct |
4 |
Correct |
3 ms |
3408 KB |
Output is correct |
5 |
Correct |
3 ms |
3408 KB |
Output is correct |
6 |
Correct |
3 ms |
3408 KB |
Output is correct |
7 |
Correct |
3 ms |
3408 KB |
Output is correct |
8 |
Correct |
3 ms |
3576 KB |
Output is correct |
9 |
Correct |
3 ms |
3408 KB |
Output is correct |
10 |
Correct |
3 ms |
3408 KB |
Output is correct |
11 |
Correct |
3 ms |
3408 KB |
Output is correct |
12 |
Correct |
9 ms |
4092 KB |
Output is correct |
13 |
Correct |
10 ms |
3920 KB |
Output is correct |
14 |
Correct |
14 ms |
4176 KB |
Output is correct |
15 |
Correct |
122 ms |
6384 KB |
Output is correct |
16 |
Correct |
134 ms |
6472 KB |
Output is correct |
17 |
Correct |
125 ms |
6728 KB |
Output is correct |
18 |
Correct |
134 ms |
6472 KB |
Output is correct |
19 |
Correct |
336 ms |
6984 KB |
Output is correct |
20 |
Correct |
242 ms |
6472 KB |
Output is correct |
21 |
Correct |
385 ms |
7204 KB |
Output is correct |
22 |
Correct |
392 ms |
6980 KB |
Output is correct |