#include <bits/stdc++.h>
using namespace std;
long long h[100001LL];
long long v[100001LL];
int main()
{
long long nb;
cin>>nb;
long long tab[nb][2LL];
for (long long i=0LL;i<nb;i+=1LL)
{
cin>>tab[i][0LL]>>tab[i][1LL];
h[tab[i][0LL]]+=1LL;
v[tab[i][1LL]]+=1LL;
}
long long total=0LL;
for (long long i=0LL;i<nb;i+=1LL)
{
long long in=((h[tab[i][0LL]]-1LL)*(v[tab[i][1LL]]-1LL));
if (in>0LL)
total+=in;
}
cout<<total;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
360 KB |
Output is correct |
3 |
Correct |
2 ms |
600 KB |
Output is correct |
4 |
Correct |
2 ms |
720 KB |
Output is correct |
5 |
Incorrect |
2 ms |
720 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |