#include<bits/stdc++.h>
#define ll long long
using namespace std;
//masukin nilai n; trus masukin nilai Xi dan Yi ke array;;
//cari banyak titik yang Xnya sama dengan Xi; dan Ynya sama dengan Yi, terus kaliin;
//tambahin ke ans;
const int a=3e5;
ll x[a + 5], y[a + 5];
ll cntX[a+5], cntY[a+5];
int main(){
ll n; cin>>n;
for(ll i=0; i<n; i++){
cin>>x[i]>>y[i];
cntX[x[i]]++;
cntY[x[i]]++;
}
ll ans=0;
for(ll i=0; i<n; i++){
ans+=(cntX[x[i]]-1)*(cntY[y[i]]-1);
}
cout<<ans<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
1 ms |
6492 KB |
Output is correct |
4 |
Incorrect |
1 ms |
6488 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |