#include <bits/stdc++.h>
using namespace std;
const int N = 3e5+10;
int x[N], y[N];
map<int,int> X, Y;
int main() {
int n;
cin >> n;
for(int i = 1; i <= n; ++i) {
cin >> x[i] >> y[i];
++X[x[i]];
++Y[y[i]];
}
long long ans = 0;
for(int i = 1; i <= n; ++i) {
ans += (long long)(X[x[i]] - 1) * (Y[y[i]] - 1);
}
cout << ans << '\n';
}
# |
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 |
364 KB |
Output is correct |
4 |
Correct |
0 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 |
2 ms |
364 KB |
Output is correct |
11 |
Correct |
2 ms |
364 KB |
Output is correct |
12 |
Correct |
12 ms |
876 KB |
Output is correct |
13 |
Correct |
14 ms |
876 KB |
Output is correct |
14 |
Correct |
18 ms |
1260 KB |
Output is correct |
15 |
Correct |
217 ms |
4076 KB |
Output is correct |
16 |
Correct |
217 ms |
4204 KB |
Output is correct |
17 |
Correct |
209 ms |
4204 KB |
Output is correct |
18 |
Correct |
200 ms |
4076 KB |
Output is correct |
19 |
Correct |
579 ms |
7248 KB |
Output is correct |
20 |
Correct |
410 ms |
9452 KB |
Output is correct |
21 |
Correct |
659 ms |
12172 KB |
Output is correct |
22 |
Correct |
700 ms |
12132 KB |
Output is correct |