Submission #974848

#TimeUsernameProblemLanguageResultExecution timeMemory
974848vjudge1Star triangles (IZhO11_triangle)C++98
100 / 100
400 ms12292 KiB
#include <bits/stdc++.h> using namespace std; int n; int x[300000+5],y[300000+5]; map<int,int> cntX,cntY; int main(){ cin>>n; for (int i = 0; i < n; i++) { int tempX,tempY; cin>>tempX>>tempY; x[i]=tempX; y[i]=tempY; cntX[tempX]++; cntY[tempY]++; } long long ans=0; for (int i = 0; i < n; i++) { ans+=1ll*(cntX[x[i]]-1)*(cntY[y[i]]-1); } cout<<ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...