제출 #1219532

#제출 시각아이디문제언어결과실행 시간메모리
1219532putuputu별들과 삼각형 (IZhO11_triangle)C++20
100 / 100
176 ms8740 KiB
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    int n;
    cin >> n;
    vector<pair<int, int>> p;
    for(int i=0; i<n; i++){
        int x, y;
        cin >> x >> y;
        p.push_back({x, y});
    }
    unordered_map<int, int> cnt1, cnt2;
    for(int i=0; i<n; i++){
        cnt1[p[i].first]++;
        cnt2[p[i].second]++;
    }
    int ans=0;
    for(int i=0; i<n; i++){
        ans+=(cnt1[p[i].first]-1)*(cnt2[p[i].second]-1);
    }
    cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...