Pagini recente » Cod sursa (job #1484376) | Cod sursa (job #1097185) | Statistici Manole Alexandru-Daniel (Alex_de_la_Lizeanu) | Cod sursa (job #1367733) | Cod sursa (job #2321503)
#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("trapez.in");
ofstream fout("trapez.out");
int N;
int nrX, nrY;
int xs[1005], ys[1005];
int main()
{
fin >> N;
for(int i = 1; i <= N; i++)
fin >> xs[i] >> ys[i];
sort(xs + 1, xs + N + 1);
sort(ys + 1, ys + N + 1);
for(int i = 2; i < N; i++)
if(xs[i] == xs[i - 1])
nrX++;
for(int i = 2; i < N; i++)
if(ys[i] == ys[i - 1])
nrY++;
int ans = nrX * (nrX - 1) / 2 + nrY * (nrY - 1) / 2;
fout << ans;
return 0;
}