#include<bits/stdc++.h>
#define x first
#define y second
using namespace std;
const int N = 3e5+5;
pair<int,int> p[N];
map<int,int> mp,mp1;
int main(){
ios::sync_with_stdio(0);cin.tie(0);
cout.tie(0);
int n,ans=0;
cin>>n;
for(int i=1;i<=n;i++) cin>>p[i].x>>p[i].y, mp[p[i].x]++,mp1[p[i].y]++;
for(int i=1;i<=n;i++){
ans += (long long )(mp[p[i].x]-1) * (long long )(mp1[p[i].y]-1);
}
cout<<ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
464 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
5 ms |
984 KB |
Output is correct |
13 |
Correct |
5 ms |
1624 KB |
Output is correct |
14 |
Correct |
7 ms |
1372 KB |
Output is correct |
15 |
Correct |
84 ms |
7508 KB |
Output is correct |
16 |
Correct |
87 ms |
7760 KB |
Output is correct |
17 |
Correct |
80 ms |
7508 KB |
Output is correct |
18 |
Correct |
80 ms |
7748 KB |
Output is correct |
19 |
Correct |
220 ms |
11636 KB |
Output is correct |
20 |
Correct |
155 ms |
9964 KB |
Output is correct |
21 |
Correct |
231 ms |
12300 KB |
Output is correct |
22 |
Correct |
243 ms |
12408 KB |
Output is correct |