#include<bits/stdc++.h>
using namespace std;
using ll = long long;
signed main() {
int n;
cin >> n;
map<int, vector<int>> xx;
map<int, ll> yy;
for (int i = 0; i< n; i++) {
int x, y;
cin >> x >> y;
xx[x].push_back(y);
yy[y]++;
}
ll ans = 0;
for (auto [x, v] : xx) {
for (int y : v) {
ans += (yy[y] - 1LL) * (ll) (v.size() - 1LL);
}
}
cout << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 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 |
0 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 |
348 KB |
Output is correct |
12 |
Correct |
8 ms |
1116 KB |
Output is correct |
13 |
Correct |
9 ms |
1336 KB |
Output is correct |
14 |
Correct |
12 ms |
1828 KB |
Output is correct |
15 |
Correct |
127 ms |
5716 KB |
Output is correct |
16 |
Correct |
139 ms |
5972 KB |
Output is correct |
17 |
Correct |
125 ms |
5716 KB |
Output is correct |
18 |
Correct |
156 ms |
5952 KB |
Output is correct |
19 |
Correct |
396 ms |
7856 KB |
Output is correct |
20 |
Correct |
272 ms |
7092 KB |
Output is correct |
21 |
Correct |
409 ms |
8088 KB |
Output is correct |
22 |
Correct |
426 ms |
8024 KB |
Output is correct |