#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int x[300000];
int y[300000];
void solve() {
unordered_map<int, int> xs;
unordered_map<int, int> ys;
int n;
cin >> n;
for(int i = 0; i < n; i++) {
cin >> x[i] >> y[i];
xs[x[i]]++;
ys[y[i]]++;
}
ll ret = 0;
for(int i = 0; i < n; i++) {
ret += (xs[x[i]] - 1LL) * (ys[y[i]] - 1LL);
}
cout << ret << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
416 KB |
Output is correct |
4 |
Correct |
2 ms |
548 KB |
Output is correct |
5 |
Correct |
2 ms |
548 KB |
Output is correct |
6 |
Correct |
2 ms |
548 KB |
Output is correct |
7 |
Correct |
2 ms |
548 KB |
Output is correct |
8 |
Correct |
2 ms |
696 KB |
Output is correct |
9 |
Correct |
2 ms |
696 KB |
Output is correct |
10 |
Correct |
2 ms |
696 KB |
Output is correct |
11 |
Correct |
2 ms |
728 KB |
Output is correct |
12 |
Correct |
7 ms |
1276 KB |
Output is correct |
13 |
Correct |
7 ms |
1320 KB |
Output is correct |
14 |
Correct |
10 ms |
1588 KB |
Output is correct |
15 |
Correct |
58 ms |
4372 KB |
Output is correct |
16 |
Correct |
63 ms |
4500 KB |
Output is correct |
17 |
Correct |
57 ms |
4500 KB |
Output is correct |
18 |
Correct |
57 ms |
4500 KB |
Output is correct |
19 |
Correct |
142 ms |
5924 KB |
Output is correct |
20 |
Correct |
122 ms |
5924 KB |
Output is correct |
21 |
Correct |
157 ms |
6084 KB |
Output is correct |
22 |
Correct |
148 ms |
6160 KB |
Output is correct |