Submission #975577

#TimeUsernameProblemLanguageResultExecution timeMemory
975577vjudge1별들과 삼각형 (IZhO11_triangle)C++17
100 / 100
496 ms32016 KiB
#include <bits/stdc++.h>
#define ll long long
using namespace std;

map <int, ll> X, Y;
map <ll, bool> test;
int x[300005] = {}, y[300005] = {};
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int N;
	cin >> N;
	ll ans = 0;
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> y[i];
		ll t = (ll)(1e9 + 5) * (ll)(x[i]) + (ll)(y[i]);
		if (test[t])
			continue;
		X[x[i]]++; Y[y[i]]++;
		test[t] = 1;
	}
	for (int i = 0; i < N; i++)
		ans += (X[x[i]] - 1) * (Y[y[i]] - 1);
	cout << ans << '\n';
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...