제출 #1245594

#제출 시각아이디문제언어결과실행 시간메모리
1245594blackmonkey48별들과 삼각형 (IZhO11_triangle)C++20
100 / 100
225 ms5860 KiB
//=======================================================================================================================================================================================================================================================================================================================
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>


int main() {
    ios_base::sync_with_stdio(false);cin.tie(nullptr);
    int n; cin >> n;
    int x[n], y[n];
    map<int,int> X,Y;
    for(int i=0;i<n;i++){
        cin >> x[i] >> y [i];
        X[x[i]]++; Y[y[i]]++;
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        ans+= (X[x[i]]-1) * (Y[y[i]]-1);
    }
    cout << ans << endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...