#include <bits/stdc++.h>
using namespace std;
int x[300005], y[300005];
map <int, int> cntx, cnty;
int main() {
int n, i, ans;
cin >> n;
for(i = 0; i < n; i++) {
cin >> x[i] >> y[i];
cntx[x[i]]++;
cnty[y[i]]++;
}
ans = 0;
for(i = 0; i < n; i++)
ans += (cntx[x[i]] - 1) * (cnty[y[i]] - 1);
cout << ans << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
472 KB |
Output is correct |
3 |
Correct |
2 ms |
472 KB |
Output is correct |
4 |
Correct |
2 ms |
472 KB |
Output is correct |
5 |
Correct |
2 ms |
472 KB |
Output is correct |
6 |
Correct |
2 ms |
472 KB |
Output is correct |
7 |
Correct |
3 ms |
636 KB |
Output is correct |
8 |
Correct |
2 ms |
648 KB |
Output is correct |
9 |
Correct |
3 ms |
680 KB |
Output is correct |
10 |
Correct |
3 ms |
680 KB |
Output is correct |
11 |
Correct |
3 ms |
680 KB |
Output is correct |
12 |
Correct |
16 ms |
1256 KB |
Output is correct |
13 |
Correct |
17 ms |
1568 KB |
Output is correct |
14 |
Correct |
24 ms |
2164 KB |
Output is correct |
15 |
Correct |
255 ms |
7008 KB |
Output is correct |
16 |
Correct |
277 ms |
9524 KB |
Output is correct |
17 |
Correct |
310 ms |
11608 KB |
Output is correct |
18 |
Correct |
309 ms |
13736 KB |
Output is correct |
19 |
Correct |
856 ms |
21396 KB |
Output is correct |
20 |
Correct |
639 ms |
25016 KB |
Output is correct |
21 |
Correct |
932 ms |
32256 KB |
Output is correct |
22 |
Correct |
901 ms |
38552 KB |
Output is correct |