#include<bits/stdc++.h>
using namespace std;
#define L long long
int main(){
L n,i,a[300001],b[300001],s=0;
map<L,L>x,y;
cin>>n;
for(i=1;i<=n;i++){
cin>>a[i]>>b[i];
x[a[i]]++;
y[b[i]]++;
}
for(i=1;i<=n;i++){
s+=(x[a[i]]-1)*(y[b[i]]-1);
}
cout<<s;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
4944 KB |
Output is correct |
2 |
Correct |
4 ms |
4944 KB |
Output is correct |
3 |
Correct |
4 ms |
5120 KB |
Output is correct |
4 |
Correct |
4 ms |
4944 KB |
Output is correct |
5 |
Correct |
4 ms |
4944 KB |
Output is correct |
6 |
Correct |
4 ms |
5116 KB |
Output is correct |
7 |
Correct |
4 ms |
4908 KB |
Output is correct |
8 |
Correct |
4 ms |
4944 KB |
Output is correct |
9 |
Correct |
4 ms |
4944 KB |
Output is correct |
10 |
Correct |
5 ms |
4944 KB |
Output is correct |
11 |
Correct |
5 ms |
5200 KB |
Output is correct |
12 |
Correct |
11 ms |
5692 KB |
Output is correct |
13 |
Correct |
12 ms |
5968 KB |
Output is correct |
14 |
Correct |
16 ms |
6280 KB |
Output is correct |
15 |
Correct |
134 ms |
11028 KB |
Output is correct |
16 |
Correct |
143 ms |
11336 KB |
Output is correct |
17 |
Correct |
135 ms |
11168 KB |
Output is correct |
18 |
Correct |
132 ms |
10972 KB |
Output is correct |
19 |
Correct |
362 ms |
15368 KB |
Output is correct |
20 |
Correct |
263 ms |
13288 KB |
Output is correct |
21 |
Correct |
407 ms |
15432 KB |
Output is correct |
22 |
Correct |
412 ms |
15432 KB |
Output is correct |