Submission #975623

#TimeUsernameProblemLanguageResultExecution timeMemory
975623vjudge1Star triangles (IZhO11_triangle)C++17
100 / 100
375 ms9224 KiB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define F first
#define S second
#define pll pair<ll, ll>
#define v(a) vector<a>

int main(){
    ll n; cin >> n;
    map<ll, ll> x, y;
    v(pll) arr(n);
    for(int i = 0; i < n; i++){
        cin >> arr[i].F >> arr[i].S;
        x[arr[i].F]++; y[arr[i].S]++;
    }

    ll ans = 0;
    for(int i = 0; i < n; i++){
        ll xx = x[arr[i].F]-1, yy = y[arr[i].S]-1;
        ans += (xx*yy);
    }

    cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...