답안 #166016

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
166016 2019-11-30T08:01:26 Z Dovran 별들과 삼각형 (IZhO11_triangle) C++11
0 / 100
2 ms 376 KB
#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, ll>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+=max((ll)0, min(b[p[i].ss]-1, a[p[i].ff]-1));
	
	cout<<ans;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -