-
Notifications
You must be signed in to change notification settings - Fork 0
/
650A.cpp
38 lines (34 loc) · 767 Bytes
/
650A.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
int main()
{
ll n;
cin >> n;
vector < pair < int , int > > v;
map < pair < int ,int > , int >p;
map < int , int > m;
map < int , int > m1;
for(int i = 0 ; i < n ; i ++)
{
ll x, y;
cin >> x >> y;
v.push_back({x, y});
p[{x, y}]++;
m[x]++;
m1[y]++;
}
ll ans =0 ;
for(int i = 0 ; i < n ; i ++)
{
ll a = --m[v[i].first];
ll b = --m1[v[i].second];
ll total = a + b;
//cout << a << " " << b << endl;
total -= ( --p[{v[i].first , v[i].second}]);
ans += total;
//cout << total << endl;
}
cout << ans << endl;
}