#include <bits/stdc++.h>
#define int long long
#define ld long double
using namespace std;
const int n=3e5+5;
signed main(){
int a; cin>>a;
int ax[n], ay[n];
map<int,int>jumlahx;
map<int,int>jumlahy;
for(int i=0;i<a;i++){
cin>>ax[i]>>ay[i];
jumlahx[ax[i]]++;
jumlahy[ay[i]]++;
}
int ans=0;
for (int i=0;i<a;i++){
ans+=(jumlahx[ax[i]]-1)*(jumlahy[ay[i]]-1);
}
cout<<ans<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4944 KB |
Output is correct |
2 |
Correct |
5 ms |
4944 KB |
Output is correct |
3 |
Correct |
5 ms |
4944 KB |
Output is correct |
4 |
Correct |
4 ms |
5128 KB |
Output is correct |
5 |
Correct |
5 ms |
4944 KB |
Output is correct |
6 |
Correct |
4 ms |
4944 KB |
Output is correct |
7 |
Correct |
4 ms |
4976 KB |
Output is correct |
8 |
Correct |
4 ms |
4944 KB |
Output is correct |
9 |
Correct |
5 ms |
4944 KB |
Output is correct |
10 |
Correct |
4 ms |
4944 KB |
Output is correct |
11 |
Correct |
5 ms |
4944 KB |
Output is correct |
12 |
Correct |
12 ms |
5712 KB |
Output is correct |
13 |
Correct |
13 ms |
5712 KB |
Output is correct |
14 |
Correct |
18 ms |
5968 KB |
Output is correct |
15 |
Correct |
145 ms |
8904 KB |
Output is correct |
16 |
Correct |
153 ms |
9032 KB |
Output is correct |
17 |
Correct |
139 ms |
8776 KB |
Output is correct |
18 |
Correct |
146 ms |
8824 KB |
Output is correct |
19 |
Correct |
400 ms |
9156 KB |
Output is correct |
20 |
Correct |
268 ms |
9032 KB |
Output is correct |
21 |
Correct |
405 ms |
9204 KB |
Output is correct |
22 |
Correct |
396 ms |
9112 KB |
Output is correct |