제출 #523927

#제출 시각아이디문제언어결과실행 시간메모리
523927Bill_00별들과 삼각형 (IZhO11_triangle)C++14
100 / 100
150 ms11856 KiB
#include <bits/stdc++.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int x[1000000], y[1000000];
unordered_map<int, ll> um[2];

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> x[i] >> y[i];
		um[0][x[i]]++;
		um[1][y[i]]++;
	}
	ll ans = 0;
	for(int i = 1; i <= n; i++){
		ans += ((um[0][x[i]] - 1) * (um[1][y[i]] - 1));
	}
	cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...