#include <iostream>
#include <unordered_map>
using namespace std;
const int N = 3e5 + 5;
pair <int, int> s[N];
unordered_map <int, int> mx, my;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, ans = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s[i].first >> s[i].second;
mx[s[i].first]++;
my[s[i].second]++;
}
for (int i = 0; i < n; i++) {
ans += (mx[s[i].first] - 1) * (my[s[i].second] - 1);
}
cout << ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 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 |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
4 ms |
860 KB |
Output is correct |
13 |
Correct |
4 ms |
1132 KB |
Output is correct |
14 |
Correct |
3 ms |
1372 KB |
Output is correct |
15 |
Correct |
32 ms |
7412 KB |
Output is correct |
16 |
Correct |
25 ms |
7468 KB |
Output is correct |
17 |
Correct |
33 ms |
7444 KB |
Output is correct |
18 |
Correct |
28 ms |
7456 KB |
Output is correct |
19 |
Correct |
66 ms |
11276 KB |
Output is correct |
20 |
Correct |
49 ms |
9596 KB |
Output is correct |
21 |
Correct |
72 ms |
11788 KB |
Output is correct |
22 |
Correct |
62 ms |
11980 KB |
Output is correct |