#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<int> X(N), Y(N);
for (int i = 0; i < N; i++){
cin >> X[i] >> Y[i];
}
map<int, int> mpX, mpY;
for (int i = 0; i < N; i++){
mpX[X[i]]++;
mpY[Y[i]]++;
}
long long ans = 0;
for (int i = 0; i < N; i++){
ans += (long long) (mpX[X[i]] - 1) * (mpY[Y[i]] - 1);
}
cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
308 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
296 KB |
Output is correct |
5 |
Correct |
1 ms |
292 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
312 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
11 ms |
980 KB |
Output is correct |
13 |
Correct |
13 ms |
980 KB |
Output is correct |
14 |
Correct |
17 ms |
1364 KB |
Output is correct |
15 |
Correct |
185 ms |
6056 KB |
Output is correct |
16 |
Correct |
168 ms |
6348 KB |
Output is correct |
17 |
Correct |
153 ms |
6168 KB |
Output is correct |
18 |
Correct |
162 ms |
6092 KB |
Output is correct |
19 |
Correct |
448 ms |
11656 KB |
Output is correct |
20 |
Correct |
322 ms |
9280 KB |
Output is correct |
21 |
Correct |
486 ms |
12188 KB |
Output is correct |
22 |
Correct |
452 ms |
12108 KB |
Output is correct |