Submission #787479

#TimeUsernameProblemLanguageResultExecution timeMemory
787479antonStar triangles (IZhO11_triangle)C++17
100 / 100
400 ms15552 KiB
#include<bits/stdc++.h> using namespace std; #define int long long const int MAX_N = 3*1e6; int n, pos[MAX_N][2]; map<int, int> x; map<int, int> y; signed main(){ cin>>n; for(int i = 0; i<n; i++){ cin>>pos[i][0]>>pos[i][1]; x[pos[i][0]]++; y[pos[i][1]]++; } int res= 0; for(int i = 0; i<n; i++){ res+=(x[pos[i][0]]-1LL)*(y[pos[i][1]]-1); } cout<<res<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...