#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
4952 KB |
Output is correct |
2 |
Correct |
3 ms |
4956 KB |
Output is correct |
3 |
Correct |
3 ms |
4956 KB |
Output is correct |
4 |
Correct |
2 ms |
4956 KB |
Output is correct |
5 |
Correct |
3 ms |
4956 KB |
Output is correct |
6 |
Correct |
3 ms |
4956 KB |
Output is correct |
7 |
Correct |
3 ms |
4956 KB |
Output is correct |
8 |
Correct |
3 ms |
4956 KB |
Output is correct |
9 |
Correct |
3 ms |
5208 KB |
Output is correct |
10 |
Correct |
3 ms |
4956 KB |
Output is correct |
11 |
Correct |
4 ms |
4956 KB |
Output is correct |
12 |
Correct |
10 ms |
5720 KB |
Output is correct |
13 |
Correct |
15 ms |
5724 KB |
Output is correct |
14 |
Correct |
14 ms |
5980 KB |
Output is correct |
15 |
Correct |
127 ms |
8872 KB |
Output is correct |
16 |
Correct |
146 ms |
9048 KB |
Output is correct |
17 |
Correct |
128 ms |
8788 KB |
Output is correct |
18 |
Correct |
139 ms |
8964 KB |
Output is correct |
19 |
Correct |
345 ms |
9044 KB |
Output is correct |
20 |
Correct |
264 ms |
9044 KB |
Output is correct |
21 |
Correct |
396 ms |
9068 KB |
Output is correct |
22 |
Correct |
374 ms |
9044 KB |
Output is correct |