Submission #523162

#TimeUsernameProblemLanguageResultExecution timeMemory
523162Pety별들과 삼각형 (IZhO11_triangle)C++14
100 / 100
330 ms12252 KiB
#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int INF = 1e9;
const int MOD = 1e9 + 7;

map<int, int>X;
map<int, int>Y;
int x[300002], y[300002], n;

int main () 
{
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> y[i];
    X[x[i]]++;
    Y[y[i]]++;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += 1ll * (X[x[i]] - 1) * (Y[y[i]] - 1);
  }
  cout << ans;
  
  return 0;
}

#Verdict Execution timeMemoryGrader output
Fetching results...