#include <bits/stdc++.h>
using namespace std;
int n;
int x[300000+5],y[300000+5];
map<int,int> cntX,cntY;
int main(){
cin>>n;
for (int i = 0; i < n; i++)
{
int tempX,tempY;
cin>>tempX>>tempY;
x[i]=tempX;
y[i]=tempY;
cntX[tempX]++;
cntY[tempY]++;
}
long long ans=0;
for (int i = 0; i < n; i++)
{
ans+=1ll*(cntX[x[i]]-1)*(cntY[y[i]]-1);
}
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2484 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2392 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2392 KB |
Output is correct |
9 |
Correct |
1 ms |
2496 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
2 ms |
2396 KB |
Output is correct |
12 |
Correct |
9 ms |
3144 KB |
Output is correct |
13 |
Correct |
11 ms |
3164 KB |
Output is correct |
14 |
Correct |
13 ms |
3416 KB |
Output is correct |
15 |
Correct |
136 ms |
7764 KB |
Output is correct |
16 |
Correct |
143 ms |
7956 KB |
Output is correct |
17 |
Correct |
128 ms |
7592 KB |
Output is correct |
18 |
Correct |
126 ms |
7508 KB |
Output is correct |
19 |
Correct |
400 ms |
11488 KB |
Output is correct |
20 |
Correct |
257 ms |
9808 KB |
Output is correct |
21 |
Correct |
387 ms |
12292 KB |
Output is correct |
22 |
Correct |
394 ms |
12284 KB |
Output is correct |