제출 #1257710

#제출 시각아이디문제언어결과실행 시간메모리
1257710islam_2010Star triangles (IZhO11_triangle)C++20
100 / 100
190 ms7808 KiB

#include <bits/stdc++.h>
#define int long long
using namespace std;

const int sz = 2005;



signed main(){

    int n;
    cin >> n;
    int a[n], b[n];
    unordered_map<int, int> mpa, mpb;
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
        mpa[a[i]]++;
        mpb[b[i]]++;
    }int ans = 0;
    for(int i = 0; i < n; i++){
        ans += (mpa[a[i]]-1) * (mpb[b[i]]-1);
    }cout << ans << endl;

}
#Verdict Execution timeMemoryGrader output
Fetching results...