제출 #166000

#제출 시각아이디문제언어결과실행 시간메모리
166000Dovran별들과 삼각형 (IZhO11_triangle)C++11
0 / 100
2 ms376 KiB
#include <bits/stdc++.h>
#define N 400009
#define ff first
#define ss second
#define pb push_back
#define ll long long
#define pii pair <ll, ll>

using namespace std;

ll n, ans;
map<ll, int>a, b;
pii p[N];

int main(){
	cin>>n;
	for(int i=1; i<=n; i++)
		cin>>p[i].ff>>p[i].ss, a[p[i].ff]++, b[p[i].ss]++;
	
	for(int i=1; i<=n; i++){
		ans+=min(a[p[i].ff]-1, b[p[i].ss]-1);
	}
	cout<<ans;

}
#Verdict Execution timeMemoryGrader output
Fetching results...