#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int n;
cin >> n;
map<int, int> x, y;
vector<pair<int, int>> points(n);
for (int i = 0; i < n; i++) {
int a, b;
cin >> a >> b;
x[a]++, y[b]++;
points[i].first = a, points[i].second = b;
}
ll ans = 0;
for (int i = 0; i < n; i++) {
ans += 1ll*(x[points[i].first]-1)*(y[points[i].second]-1);
}
cout << ans << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
444 KB |
Output is correct |
12 |
Correct |
7 ms |
1116 KB |
Output is correct |
13 |
Correct |
9 ms |
1176 KB |
Output is correct |
14 |
Correct |
12 ms |
1372 KB |
Output is correct |
15 |
Correct |
142 ms |
6156 KB |
Output is correct |
16 |
Correct |
142 ms |
6480 KB |
Output is correct |
17 |
Correct |
128 ms |
6228 KB |
Output is correct |
18 |
Correct |
127 ms |
6172 KB |
Output is correct |
19 |
Correct |
345 ms |
11404 KB |
Output is correct |
20 |
Correct |
254 ms |
9296 KB |
Output is correct |
21 |
Correct |
384 ms |
12104 KB |
Output is correct |
22 |
Correct |
376 ms |
12268 KB |
Output is correct |