Submission #4855

#TimeUsernameProblemLanguageResultExecution timeMemory
4855cki86201Star triangles (IZhO11_triangle)C++98
100 / 100
480 ms6588 KiB
#include<stdio.h> #include<map> using namespace std; typedef long long ll; map <int,int> M[2]; map <int,int>::iterator p; int x[300030],y[300030]; int main(){ int n,i; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d%d",x+i,y+i); M[0][x[i]]++, M[1][y[i]]++; } ll ans = 0; for(i=0;i<n;i++)ans += (ll)(M[0][x[i]]-1) * (M[1][y[i]]-1); printf("%lld",ans); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...