#include<stdio.h>
#include<map>
using namespace std;
typedef long long ll;
map <int,int> M[2];
map <int,int>::iterator p;
int x[300030],y[300030];
int main(){
int n,i;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d%d",x+i,y+i);
M[0][x[i]]++, M[1][y[i]]++;
}
ll ans = 0;
for(i=0;i<n;i++)ans += (ll)(M[0][x[i]]-1) * (M[1][y[i]]-1);
printf("%lld",ans);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
3552 KB |
Output is correct |
2 |
Correct |
0 ms |
3552 KB |
Output is correct |
3 |
Correct |
0 ms |
3552 KB |
Output is correct |
4 |
Correct |
0 ms |
3552 KB |
Output is correct |
5 |
Correct |
0 ms |
3552 KB |
Output is correct |
6 |
Correct |
0 ms |
3552 KB |
Output is correct |
7 |
Correct |
0 ms |
3552 KB |
Output is correct |
8 |
Correct |
0 ms |
3552 KB |
Output is correct |
9 |
Correct |
0 ms |
3552 KB |
Output is correct |
10 |
Correct |
0 ms |
3552 KB |
Output is correct |
11 |
Correct |
0 ms |
3552 KB |
Output is correct |
12 |
Correct |
8 ms |
3948 KB |
Output is correct |
13 |
Correct |
8 ms |
3948 KB |
Output is correct |
14 |
Correct |
8 ms |
4344 KB |
Output is correct |
15 |
Correct |
152 ms |
6456 KB |
Output is correct |
16 |
Correct |
176 ms |
6456 KB |
Output is correct |
17 |
Correct |
152 ms |
6456 KB |
Output is correct |
18 |
Correct |
180 ms |
6456 KB |
Output is correct |
19 |
Correct |
448 ms |
6588 KB |
Output is correct |
20 |
Correct |
324 ms |
6588 KB |
Output is correct |
21 |
Correct |
480 ms |
6588 KB |
Output is correct |
22 |
Correct |
444 ms |
6588 KB |
Output is correct |