Submission #878475

#TimeUsernameProblemLanguageResultExecution timeMemory
878475Kak008723Star triangles (IZhO11_triangle)C++14
100 / 100
243 ms12408 KiB
#include<bits/stdc++.h> #define x first #define y second using namespace std; const int N = 3e5+5; pair<int,int> p[N]; map<int,int> mp,mp1; int main(){ ios::sync_with_stdio(0);cin.tie(0); cout.tie(0); int n,ans=0; cin>>n; for(int i=1;i<=n;i++) cin>>p[i].x>>p[i].y, mp[p[i].x]++,mp1[p[i].y]++; for(int i=1;i<=n;i++){ ans += (long long )(mp[p[i].x]-1) * (long long )(mp1[p[i].y]-1); } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...