#include<bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int n;
cin >> n;
vector<pair<int, int>> v;
map<int, int> cntX, cntY;
for(int i = 1;i <= n;i++) {
int x, y;
cin >> x >> y;
cntX[ x ]++;
cntY[ y ]++;
v.push_back({x, y});
}
long long res = 0;
for(auto c : v) {
res += 1ll * (cntX[ c.first ] - 1) * (cntY[ c.second ] - 1);
}
cout << res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
316 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
316 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
6 ms |
980 KB |
Output is correct |
13 |
Correct |
6 ms |
1064 KB |
Output is correct |
14 |
Correct |
9 ms |
1364 KB |
Output is correct |
15 |
Correct |
96 ms |
6072 KB |
Output is correct |
16 |
Correct |
100 ms |
6408 KB |
Output is correct |
17 |
Correct |
94 ms |
6112 KB |
Output is correct |
18 |
Correct |
95 ms |
6144 KB |
Output is correct |
19 |
Correct |
262 ms |
13376 KB |
Output is correct |
20 |
Correct |
180 ms |
9144 KB |
Output is correct |
21 |
Correct |
276 ms |
13384 KB |
Output is correct |
22 |
Correct |
276 ms |
13500 KB |
Output is correct |