제출 #76212

#제출 시각아이디문제언어결과실행 시간메모리
76212nvmdava별들과 삼각형 (IZhO11_triangle)C++17
100 / 100
854 ms39120 KiB
#include <bits/stdc++.h>
using namespace std;
map<int, int> x, y;
int xx[300001], yy[300001];
int main(){
	int n;
	cin>>n;
	for(int i = 1; i <= n; i++){
		cin>>xx[i]>>yy[i];
		x[xx[i]]++;
		y[yy[i]]++;
	}
	
	long long s = 0;
	
	for(int i = 1; i <= n; i++){
		s += (long long)(x[xx[i]] - 1) * (y[yy[i]] - 1);
	}
	
	cout<<s;
}
#Verdict Execution timeMemoryGrader output
Fetching results...