#include <bits/stdc++.h>
using namespace std;
int main() {
unordered_map<int, int64_t> xs;
unordered_map<int, int64_t> ys;
int n; cin >> n;
vector<pair<int, int>> v(n);
for(auto &e : v) cin >> e.first >> e.second;
for(auto e : v) {xs[e.first] += 1; ys[e.second] += 1;}
int64_t ans = 0;
for(auto e : v) {
ans = (1LL * ans + (xs[e.first] - 1) * (ys[e.second] - 1));
}
cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 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 |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
2 ms |
332 KB |
Output is correct |
12 |
Correct |
8 ms |
716 KB |
Output is correct |
13 |
Correct |
10 ms |
748 KB |
Output is correct |
14 |
Correct |
11 ms |
1008 KB |
Output is correct |
15 |
Correct |
95 ms |
3680 KB |
Output is correct |
16 |
Correct |
104 ms |
3756 KB |
Output is correct |
17 |
Correct |
99 ms |
3692 KB |
Output is correct |
18 |
Correct |
97 ms |
3684 KB |
Output is correct |
19 |
Correct |
295 ms |
5084 KB |
Output is correct |
20 |
Correct |
188 ms |
4480 KB |
Output is correct |
21 |
Correct |
284 ms |
5244 KB |
Output is correct |
22 |
Correct |
273 ms |
5348 KB |
Output is correct |