#include <bits/stdc++.h>
using namespace std;
struct point{
int x, y;
};
vector<point> P;
map<int, int> X, Y;
int main(){
int n; cin >> n;
for(int i = 0; i < n; i++){
int x, y; cin >> x >> y;
P.push_back({x, y});
X[x]++; Y[y]++;
}
int ans = 0;
for(int i = 0; i < n; i++){
ans += (X[P[i].x] - 1) * (Y[P[i].y] - 1);
}
cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
304 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
296 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
10 ms |
980 KB |
Output is correct |
13 |
Correct |
11 ms |
952 KB |
Output is correct |
14 |
Correct |
15 ms |
1364 KB |
Output is correct |
15 |
Correct |
150 ms |
6060 KB |
Output is correct |
16 |
Correct |
170 ms |
6336 KB |
Output is correct |
17 |
Correct |
184 ms |
6160 KB |
Output is correct |
18 |
Correct |
149 ms |
6080 KB |
Output is correct |
19 |
Correct |
430 ms |
13316 KB |
Output is correct |
20 |
Correct |
305 ms |
9200 KB |
Output is correct |
21 |
Correct |
458 ms |
13348 KB |
Output is correct |
22 |
Correct |
451 ms |
13240 KB |
Output is correct |