#include <iostream>
#include <map>
using namespace std;
struct ura{
int x, y;
};
ura v[300005];
map <int, int> x;
map <int, int> y;
int main()
{
int n, i;
cin >> n;
long long ans = 0;
for (i = 1; i <= n; i++)
{
cin >> v[i].x >> v[i].y;
x[v[i].x]++;
y[v[i].y]++;
}
for (i = 1; i <= n; i++)
ans += (long long)(x[v[i].x] - 1) * (y[v[i].y] - 1);
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
492 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
2 ms |
364 KB |
Output is correct |
12 |
Correct |
13 ms |
972 KB |
Output is correct |
13 |
Correct |
14 ms |
1132 KB |
Output is correct |
14 |
Correct |
18 ms |
1388 KB |
Output is correct |
15 |
Correct |
211 ms |
6252 KB |
Output is correct |
16 |
Correct |
221 ms |
6508 KB |
Output is correct |
17 |
Correct |
209 ms |
6252 KB |
Output is correct |
18 |
Correct |
252 ms |
6280 KB |
Output is correct |
19 |
Correct |
609 ms |
8684 KB |
Output is correct |
20 |
Correct |
416 ms |
8156 KB |
Output is correct |
21 |
Correct |
634 ms |
8940 KB |
Output is correct |
22 |
Correct |
667 ms |
8812 KB |
Output is correct |