#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 3e5 + 7;
int n, a[N], b[N], ans;
map <int, int> x, y;
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i] >> b[i];
x[a[i]]++; y[b[i]]++;
}
for (int i = 1; i <= n; i++) {
ans += (x[a[i]] - 1) * (y[b[i]] - 1);
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2384 KB |
Output is correct |
3 |
Correct |
1 ms |
2384 KB |
Output is correct |
4 |
Correct |
1 ms |
2384 KB |
Output is correct |
5 |
Correct |
1 ms |
2552 KB |
Output is correct |
6 |
Correct |
1 ms |
2384 KB |
Output is correct |
7 |
Correct |
1 ms |
2384 KB |
Output is correct |
8 |
Correct |
1 ms |
2552 KB |
Output is correct |
9 |
Correct |
1 ms |
2384 KB |
Output is correct |
10 |
Correct |
1 ms |
2384 KB |
Output is correct |
11 |
Correct |
2 ms |
2384 KB |
Output is correct |
12 |
Correct |
6 ms |
3152 KB |
Output is correct |
13 |
Correct |
5 ms |
3168 KB |
Output is correct |
14 |
Correct |
9 ms |
3664 KB |
Output is correct |
15 |
Correct |
98 ms |
8520 KB |
Output is correct |
16 |
Correct |
106 ms |
8520 KB |
Output is correct |
17 |
Correct |
93 ms |
8616 KB |
Output is correct |
18 |
Correct |
97 ms |
8520 KB |
Output is correct |
19 |
Correct |
263 ms |
9012 KB |
Output is correct |
20 |
Correct |
194 ms |
8780 KB |
Output is correct |
21 |
Correct |
290 ms |
9244 KB |
Output is correct |
22 |
Correct |
289 ms |
9032 KB |
Output is correct |