#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb push_back
using namespace std;
signed main(){
ios_base::sync_with_stdio();
cin.tie(0);cout.tie(0);
int n;
cin>>n;
map <int,vector <int> > xy;
map <int,int> yx;
for(int i=0;i<n;i++){
int x,y;cin>>x>>y;
xy[x].pb(y);
yx[y]++;
}
int ans=0;
for(auto i : xy){
for(auto y : i.ss){
ans+=((i.ss.size()-1)*(yx[y]-1));
}
}
cout<<ans<<"\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 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 |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
344 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 |
11 ms |
984 KB |
Output is correct |
13 |
Correct |
9 ms |
1164 KB |
Output is correct |
14 |
Correct |
14 ms |
1880 KB |
Output is correct |
15 |
Correct |
117 ms |
6432 KB |
Output is correct |
16 |
Correct |
126 ms |
6708 KB |
Output is correct |
17 |
Correct |
115 ms |
6480 KB |
Output is correct |
18 |
Correct |
117 ms |
6268 KB |
Output is correct |
19 |
Correct |
315 ms |
9560 KB |
Output is correct |
20 |
Correct |
231 ms |
8172 KB |
Output is correct |
21 |
Correct |
350 ms |
9840 KB |
Output is correct |
22 |
Correct |
343 ms |
10036 KB |
Output is correct |