#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int n;
cin >> n;
map<int, int> cx, cy;
int x[n+1], y[n+1];
for(int i = 0; i < n; i++){
cin >> x[i] >> y[i];
cx[x[i]]++;
cy[y[i]]++;
}
int ans = 0;
for(int i = 0; i < n; i++){
ans += (cx[x[i]] - 1) * (cy[y[i]] - 1);
}
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 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 |
0 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 |
10 ms |
1132 KB |
Output is correct |
13 |
Correct |
9 ms |
1372 KB |
Output is correct |
14 |
Correct |
13 ms |
1884 KB |
Output is correct |
15 |
Correct |
158 ms |
7816 KB |
Output is correct |
16 |
Correct |
162 ms |
8320 KB |
Output is correct |
17 |
Correct |
125 ms |
7928 KB |
Output is correct |
18 |
Correct |
131 ms |
8020 KB |
Output is correct |
19 |
Correct |
406 ms |
15168 KB |
Output is correct |
20 |
Correct |
251 ms |
11856 KB |
Output is correct |
21 |
Correct |
385 ms |
15464 KB |
Output is correct |
22 |
Correct |
374 ms |
15444 KB |
Output is correct |