#include <bits/stdc++.h>
using namespace std;
const int kaps = 3e5 + 5;
int main(){
long long n;
cin >> n;
int x[kaps], y[kaps];
int ans = 0;
map <int, int> jx;
map <int, int> jy;
for(int i = 0; i < n; i++){
cin >> x[i] >> y[i];
jx[x[i]]++;
jy[y[i]]++;
}for(int i = 0; i < n; i++){
ans += (jx[x[i]] - 1) * (jy[y[i]] - 1);
}cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2648 KB |
Output is correct |
2 |
Correct |
1 ms |
2652 KB |
Output is correct |
3 |
Correct |
2 ms |
2652 KB |
Output is correct |
4 |
Correct |
1 ms |
2648 KB |
Output is correct |
5 |
Correct |
1 ms |
2648 KB |
Output is correct |
6 |
Correct |
2 ms |
2652 KB |
Output is correct |
7 |
Correct |
2 ms |
2652 KB |
Output is correct |
8 |
Correct |
2 ms |
2648 KB |
Output is correct |
9 |
Correct |
3 ms |
2904 KB |
Output is correct |
10 |
Correct |
2 ms |
2652 KB |
Output is correct |
11 |
Correct |
2 ms |
2776 KB |
Output is correct |
12 |
Correct |
9 ms |
3160 KB |
Output is correct |
13 |
Correct |
10 ms |
3164 KB |
Output is correct |
14 |
Correct |
13 ms |
3420 KB |
Output is correct |
15 |
Correct |
127 ms |
5640 KB |
Output is correct |
16 |
Correct |
139 ms |
5716 KB |
Output is correct |
17 |
Correct |
124 ms |
5460 KB |
Output is correct |
18 |
Correct |
125 ms |
5656 KB |
Output is correct |
19 |
Correct |
346 ms |
5600 KB |
Output is correct |
20 |
Correct |
247 ms |
5820 KB |
Output is correct |
21 |
Correct |
373 ms |
5712 KB |
Output is correct |
22 |
Correct |
374 ms |
5712 KB |
Output is correct |