제출 #163295

#제출 시각아이디문제언어결과실행 시간메모리
163295tselmegkh별들과 삼각형 (IZhO11_triangle)C++14
100 / 100
1063 ms13580 KiB
#include<bits/stdc++.h>
using namespace std;

map<int, int> cntx, cnty;
int main(){
	int n;
	cin >> n;
	vector<pair<int, int>> stars;
	for(int i = 0; i < n; i++){
		int x1, y1;
		cin >> x1 >> y1;
		stars.push_back({x1, y1});
		cntx[x1]++, cnty[y1]++;
	}
	long long ans = 0;
	for(pair<int, int> st : stars){
		int x = st.first, y = st.second;
		ans += (cntx[x] - 1) * (cnty[y] - 1); 
	}
	cout << ans << '\n';
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…