Submission #86987

#TimeUsernameProblemLanguageResultExecution timeMemory
86987abilStar triangles (IZhO11_triangle)C++14
100 / 100
711 ms38916 KiB
/**
   Solution by Abil
**/
#include <bits/stdc++.h>

using namespace std;

const int N = 300000 + 12;
int x[N],y[N];
map<int,int > mpx,mpy;
int main()
{
    int n;
    cin >> n;
    for(int i = 1;i <= n; i++){
       cin >> x[i] >> y[i];
       mpx[x[i]]++;
       mpy[y[i]]++;
    }
    int ans = 0;
    for(int i = 1; i <= n; i++){
        ans += ((mpx[x[i]] - 1) * (mpy[y[i]] - 1));
    }
    cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...