#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) * (cx[y[i]] - 1);
}
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
600 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |