Pagini recente » Cod sursa (job #1771450) | Cod sursa (job #461594) | Cod sursa (job #2972243) | Cod sursa (job #802009) | Cod sursa (job #2876369)
#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
using namespace std;
ifstream fin ("trapez.in");
ofstream fout ("trapez.out");
int full_ox, full_oy;
int n, x, y;
unordered_map <int, bool> map_ox, map_oy;
int main (){
ios_base::sync_with_stdio(false);
fin.tie(nullptr);
fout.tie(nullptr);
fin>>n;
while(n--){
fin>>x>>y;
if(map_ox[x] == false)
map_ox[x] = true;
else
full_ox++;
if(map_oy[y] == false)
map_oy[y] = true;
else
full_oy++;
}
fout<<full_ox * (full_ox-1) / 2 + full_oy * (full_oy-1) / 2;
return 0;
}