제출 #680208

#제출 시각아이디문제언어결과실행 시간메모리
680208Angus_Yeung별들과 삼각형 (IZhO11_triangle)C++17
100 / 100
330 ms15552 KiB
#include <bits/stdc++.h>
#define x first
#define y second
#define pii pair<ll, ll>
typedef long long ll;
const ll MOD = 1000000007LL;
const ll INF = 1e18;
using namespace std;

ll n, x[300010], y[300010], ans;
map<ll, ll> mx, my;

int main() {
	cin.tie(0); cout.tie(0);
	ios::sync_with_stdio(0);

	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> x[i] >> y[i];
		mx[x[i]]++;
		my[y[i]]++;
	}
	
	ans = 0;
	for (int i = 1; i <= n; i++) {
		ans += (mx[x[i]]-1)*(my[y[i]]-1);
	}
	cout << ans << "\n";

	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...