#include<bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
unordered_map<int, int> xCount, yCount;
vector<pair<int, int>> points(N);
for (int i = 0; i < N; ++i) {
int x, y;
cin >> x >> y;
points[i] = make_pair(x, y);
xCount[x]++;
yCount[y]++;
}
long long totalCount = 0;
for (auto point : points) {
int x = point.first;
int y = point.second;
int sameX = xCount[x];
int sameY = yCount[y];
totalCount += (long long)(sameX - 1) * (sameY - 1);
}
cout << totalCount << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
2 ms |
348 KB |
Output is correct |
12 |
Correct |
7 ms |
860 KB |
Output is correct |
13 |
Correct |
9 ms |
1108 KB |
Output is correct |
14 |
Correct |
9 ms |
1372 KB |
Output is correct |
15 |
Correct |
74 ms |
5884 KB |
Output is correct |
16 |
Correct |
78 ms |
6180 KB |
Output is correct |
17 |
Correct |
74 ms |
5896 KB |
Output is correct |
18 |
Correct |
73 ms |
5900 KB |
Output is correct |
19 |
Correct |
197 ms |
11132 KB |
Output is correct |
20 |
Correct |
141 ms |
8888 KB |
Output is correct |
21 |
Correct |
205 ms |
11808 KB |
Output is correct |
22 |
Correct |
203 ms |
11784 KB |
Output is correct |