Submission #18635

#TimeUsernameProblemLanguageResultExecution timeMemory
18635mindolStar triangles (IZhO11_triangle)C++14
100 / 100
203 ms7036 KiB
#include<cstdio> #include<unordered_map> using namespace std; unordered_map<int,int> X,Y; int x[300001],y[300001]; int main() { int n; scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d %d",&x[i],&y[i]), X[x[i]]++, Y[y[i]]++; long long ans=0; for(int i=1;i<=n;i++) ans+=(X[x[i]]-1ll)*(Y[y[i]]-1); printf("%lld",ans); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...