제출 #89293

#제출 시각아이디문제언어결과실행 시간메모리
89293ErkhemkhuuStar triangles (IZhO11_triangle)C++17
100 / 100
932 ms38552 KiB
#include <bits/stdc++.h>
using namespace std;
int x[300005], y[300005];
map <int, int> cntx, cnty;
int main() {
	int n, i, ans;
	cin >> n;
	for(i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
		cntx[x[i]]++;
		cnty[y[i]]++;
	}
	ans = 0;
	for(i = 0; i < n; i++)
		ans += (cntx[x[i]] - 1) * (cnty[y[i]] - 1);
	cout << ans << "\n";
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...