#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector X(N, 0), Y(N, 0);
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]]++;
for(int i = 0; i < N; i++) mpy[Y[i]]++;
long long ans(0);
for(int i = 0; i < N; i++) ans += ((long long)(mpx[X[i]]-1) * (long long)(mpy[Y[i]]-1));
cout << ans << 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 |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
8 ms |
1116 KB |
Output is correct |
13 |
Correct |
10 ms |
1112 KB |
Output is correct |
14 |
Correct |
12 ms |
1344 KB |
Output is correct |
15 |
Correct |
131 ms |
6180 KB |
Output is correct |
16 |
Correct |
127 ms |
6480 KB |
Output is correct |
17 |
Correct |
117 ms |
6228 KB |
Output is correct |
18 |
Correct |
117 ms |
6224 KB |
Output is correct |
19 |
Correct |
329 ms |
11556 KB |
Output is correct |
20 |
Correct |
235 ms |
9296 KB |
Output is correct |
21 |
Correct |
348 ms |
12368 KB |
Output is correct |
22 |
Correct |
341 ms |
12112 KB |
Output is correct |