제출 #975209

#제출 시각아이디문제언어결과실행 시간메모리
975209vjudge1별들과 삼각형 (IZhO11_triangle)C++17
100 / 100
275 ms12832 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

const int N = 3e5 + 5;

map < ll, ll > mpx, mpy;

vector < pair < ll, ll >> a ( N );

ll n;

signed main(){
    ios_base::sync_with_stdio(0); cin.tie(0);

    cin >> n;

    for ( int i = 1; i <= n; i++){
        cin >> a[i].first >> a[i].second;
        mpx[a[i].first]++;
        mpy[a[i].second]++;
    }

    ll ans = 0;

    for ( int i = 1; i <= n; i++){
        ans += ( 1ll * ( mpx[a[i].first] - 1 ) * ( mpy[a[i].second] - 1) );
    }

    cout << ans << endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...