Submission #1257381

#TimeUsernameProblemLanguageResultExecution timeMemory
1257381symbioter별들과 삼각형 (IZhO11_triangle)C++20
100 / 100
231 ms5864 KiB
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long
using namespace std;


void work(){
  int n; cin >> n;
  vector<int>x(n), y(n);
  map<int, int> A, B;
  for(int i = 0; i < n ;i++){
    cin >> x[i] >> y[i];
    A[x[i]]++;
    B[y[i]]++;
  }
  ll ans = 0;
  for(int i = 0;i < n ; i++){
    ans += 1ll * (A[x[i]] - 1) * (B[y[i]] - 1);
  }
  cout << ans << endl;
}

int main(){
  ios_base::sync_with_stdio(0);cin.tie(0);
  int t = 1;// cin >> t;
  while(t--) work();
  return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...