Submission #638855

#TimeUsernameProblemLanguageResultExecution timeMemory
638855MohamedAhmed04Star triangles (IZhO11_triangle)C++14
100 / 100
268 ms12108 KiB
#include <bits/stdc++.h> using namespace std ; const int MAX = 3e5 + 10 ; int arr[MAX] ; int n ; int X[MAX] , Y[MAX] ; map<int , int>mpx , mpy ; int main() { ios_base::sync_with_stdio(0) ; cin.tie(0) ; cin>>n ; for(int i = 0 ; i < n ; ++i) cin>>X[i]>>Y[i] ; for(int i = 0 ; i < n ; ++i) mpx[X[i]]++ , mpy[Y[i]]++ ; long long ans = 0 ; for(int i = 0 ; i < n ; ++i) ans += 1ll * (mpx[X[i]]-1ll) * (mpy[Y[i]]-1ll) ; return cout<<ans<<"\n" , 0 ; }
#Verdict Execution timeMemoryGrader output
Fetching results...