Submission #532293

#TimeUsernameProblemLanguageResultExecution timeMemory
532293christinelynnStar triangles (IZhO11_triangle)C++17
100 / 100
540 ms11372 KiB
#include <bits/stdc++.h> #define ll long long #define fi first #define se second const ll MOD=1e9+7; using namespace std; ll N; pair <ll,ll> pr[300005]; map <ll,ll> x; map <ll,ll> y; int main(){ cin>>N; for(int i=1;i<=N;i++){ cin>>pr[i].fi>>pr[i].se; x[pr[i].fi]++; y[pr[i].se]++; } ll ans=0; for(int i=1;i<=N;i++){ ans+=(x[pr[i].fi]-1)*(y[pr[i].se]-1); } cout<<ans<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...