#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
map <long long, long long> mp;
for(int i=1; i<=n; i++){
long long x,y;
cin>>x>>y;
mp[y]++;
}
long long ans=0;
for(auto it : mp){
if(it.second>1){
ans+=(it.second*it.second-1)/2 * (n-it.second);
}
}
cout<<ans<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |