#include <bits/stdc++.h>
using namespace std;
int main() {
int zx, zy, n, res = 0;
cin >> n;
vector<pair<int, int> > p;
map<int, int> mx, my;
for (int i=0; i<n; i++) {
cin >> zx >> zy;
p.push_back({zx, zy});
mx[zx]++;
my[zy]++;
}
for (auto i : p) {
zx = mx[i.first] - 1;
zy = my[i.second] - 1;
res += zx * zy;
}
cout << res << endl;
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 |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 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 |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
9 ms |
972 KB |
Output is correct |
13 |
Correct |
9 ms |
860 KB |
Output is correct |
14 |
Correct |
12 ms |
1260 KB |
Output is correct |
15 |
Correct |
123 ms |
4036 KB |
Output is correct |
16 |
Correct |
157 ms |
4200 KB |
Output is correct |
17 |
Correct |
141 ms |
4140 KB |
Output is correct |
18 |
Correct |
148 ms |
4040 KB |
Output is correct |
19 |
Correct |
349 ms |
9396 KB |
Output is correct |
20 |
Correct |
250 ms |
5284 KB |
Output is correct |
21 |
Correct |
369 ms |
7864 KB |
Output is correct |
22 |
Correct |
372 ms |
8520 KB |
Output is correct |