Submission #1346649

#TimeUsernameProblemLanguageResultExecution timeMemory
1346649killerzaluuStar triangles (IZhO11_triangle)C++20
100 / 100
248 ms9224 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;

    vector<pair<long long,long long>> a(n);
    map<long long,long long> cntx, cnty;

    for (int i = 0; i < n; i++) {
        cin >> a[i].first >> a[i].second;
        cntx[a[i].first]++;
        cnty[a[i].second]++;
    }

    long long ans = 0;
    for (int i = 0; i < n; i++) {
        long long x = a[i].first;
        long long y = a[i].second;
        ans += (cntx[x] - 1) * (cnty[y] - 1);
    }

    cout << ans << '\n';
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...