Submission #975621

#TimeUsernameProblemLanguageResultExecution timeMemory
975621vjudge1Star triangles (IZhO11_triangle)C++17
100 / 100
426 ms8088 KiB
#include<bits/stdc++.h>
using namespace std;

using ll = long long;

signed main() {
	int n;
	cin >> n;

	map<int, vector<int>> xx;
	map<int, ll> yy;

	for (int i = 0; i< n; i++) {
		int x, y;
		cin >> x >> y;
		xx[x].push_back(y);
		yy[y]++;
	}

	ll ans = 0;

	for (auto [x, v] : xx) {
		for (int y : v) {
			ans += (yy[y] - 1LL) * (ll) (v.size() - 1LL);		
		}
	}

	cout << ans << '\n';
}
#Verdict Execution timeMemoryGrader output
Fetching results...