제출 #977207

#제출 시각아이디문제언어결과실행 시간메모리
977207suhu88Star triangles (IZhO11_triangle)C++14
100 / 100
255 ms15496 KiB
#include<bits/stdc++.h> #define suhu ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define fi first #define se second #define pb push_back using namespace std; typedef long long ll; const ll MAXN=3e5+5; const ll inf=1e18; ll n,a[MAXN],b[MAXN]; map<ll,ll>x; map<ll,ll>y; int main(){ suhu cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]>>b[i]; x[a[i]]++; y[b[i]]++; } ll ans=0; for(int i=1;i<=n;i++){ ans+=(x[a[i]]-1)*(y[b[i]]-1); } cout<<ans<<"\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...