제출 #674047

#제출 시각아이디문제언어결과실행 시간메모리
674047tatoStar triangles (IZhO11_triangle)C++14
100 / 100
458 ms13360 KiB
#include <bits/stdc++.h>
#define ll long long
using namespace std;


void answer() {
  int n;
  cin >> n;
  vector<pair<int, int>> v;

  map<int, int> mpx, mpy;
  int x, y;
  for(int i=1; i<=n;i++){
    cin >> x>> y;
    v.push_back({x, y});
    mpx[x]++;
    mpy[y]++;
  }
  ll ans=0;

  for(int i=0; i<n; i++){
//    cout << mpx[v[i].first] << ' ' << mpy[v[i].second] << ' ';
    ans += (mpx[v[i].first] - 1) * (mpy[v[i].second]-1);
  }

  cout << ans;

}

int main() {
  int t=1;
//  cin >> t;
  while(t--) {
    answer();
  }
}
#Verdict Execution timeMemoryGrader output
Fetching results...