제출 #976335

#제출 시각아이디문제언어결과실행 시간메모리
976335vjudge1Star triangles (IZhO11_triangle)C++17
100 / 100
254 ms13068 KiB
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define sz size
#define fr front 
#define bc backn
#define pii pair<int,int>
#define all(x) x.begin() , x.end()
#define cmin(a, b) a = min(a , b)
#define cmax(a, b) a = max(a, b)
#define mems(arr , a) memset(arr , a , sizeof arr)
#define each(i , arr) for(auto &i : arr)
const int MOD = 1e9 + 7;
const int INF = 1e18;

signed main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t;  
    t = 1;
    // cin >> t;
    while(t--){
    
        int n;  cin >> n;
        int x[n] , y[n];
        map<int , int> cntx , cnty;
        for(int i = 0; i < n; i++){
            cin >> x[i] >> y[i];
            cntx[x[i]]++ , cnty[y[i]]++;
        }
        int ans = 0;
        for(int i = 0; i < n; i++){
            ans += (cntx[x[i]]-1) * (cnty[y[i]]-1);
        }
        cout << ans << '\n';

    }


}
#Verdict Execution timeMemoryGrader output
Fetching results...