제출 #227522

#제출 시각아이디문제언어결과실행 시간메모리
227522_aniStar triangles (IZhO11_triangle)C++14
100 / 100
762 ms13304 KiB
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
const int maxn = 300002;
int n, x[maxn], y[maxn];
map <int, long long> mx, my;
long long ans;
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> x[i] >> y[i];
		mx[x[i]]++;
		my[y[i]]++;
	}
	for (int i = 0; i < n; i++)
	{
		ans += (mx[x[i]] - 1) * (my[y[i]] - 1);
	}
	cout << ans << '\n';
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...