제출 #88424

#제출 시각아이디문제언어결과실행 시간메모리
88424xiaowuc1별들과 삼각형 (IZhO11_triangle)C++14
100 / 100
491 ms34424 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int x[300000];
int y[300000];
void solve() {
  map<int, int> xs;
  map<int, int> ys;
  int n;
  cin >> n;
  for(int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    xs[x[i]]++;
    ys[y[i]]++;
  }
  ll ret = 0;
  for(int i = 0; i < n; i++) {
    ret += (xs[x[i]] - 1LL) * (ys[y[i]] - 1LL);
  }
  cout << ret << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}
#Verdict Execution timeMemoryGrader output
Fetching results...