//IOI 2023 I am coming.
#include "bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define int int64_t
#define pb push_back
#define x first
#define y second
int32_t main(){
fast;
int n;
cin>>n;
map<int,int>dx,dy;
vector<pair<int,int>>point(n);
for(int i=0;i<n;++i){
cin>>point[i].x>>point[i].y;
dx[point[i].x]++;
dy[point[i].y]++;
}
int ans=0;
for(int i=0;i<n;++i){
ans+=(dx[point[i].x]-1)*(dy[point[i].y]-1);
}
cout<<ans<<"\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
316 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
6 ms |
1148 KB |
Output is correct |
13 |
Correct |
6 ms |
1264 KB |
Output is correct |
14 |
Correct |
11 ms |
1672 KB |
Output is correct |
15 |
Correct |
99 ms |
7908 KB |
Output is correct |
16 |
Correct |
113 ms |
8340 KB |
Output is correct |
17 |
Correct |
108 ms |
7820 KB |
Output is correct |
18 |
Correct |
111 ms |
7916 KB |
Output is correct |
19 |
Correct |
275 ms |
14676 KB |
Output is correct |
20 |
Correct |
229 ms |
11760 KB |
Output is correct |
21 |
Correct |
387 ms |
15492 KB |
Output is correct |
22 |
Correct |
353 ms |
15500 KB |
Output is correct |