제출 #679964

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

typedef long long ll;
const int MAX = 2e6 + 15;

ll n, x[MAX], y[MAX], ans;
map<ll, ll> fx, fy;

int main(void){
    cin >> n;

    for(int i = 1; i <= n; i++){
        cin >> x[i] >> y[i];
        fx[x[i]]++; fy[y[i]]++;
    }

    for(int i = 1; i <= n; i++)
        ans += (fx[x[i]] - 1) * (fy[y[i]] - 1);

    cout << ans << '\n';

    exit(0);
}
#Verdict Execution timeMemoryGrader output
Fetching results...