제출 #532293

#제출 시각아이디문제언어결과실행 시간메모리
532293christinelynn별들과 삼각형 (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...