Submission #1198785

#TimeUsernameProblemLanguageResultExecution timeMemory
1198785Hamed_GhaffariStar triangles (IZhO11_triangle)C++20
100 / 100
230 ms5864 KiB
#include<bits/stdc++.h>
using namespace std;

using ll = long long;

const int MXN = 3e5+5;

int n, x[MXN], y[MXN];
map<int, int> rw, cl;

int32_t main() {
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
    cin >> n;
    for(int i=1; i<=n; i++) {
        cin >> x[i] >> y[i];
        rw[x[i]]++;
        cl[y[i]]++;
    }
    ll ans = 0;
    for(int i=1; i<=n; i++) {
        ans += 1ll*(rw[x[i]]-1)*(cl[y[i]]-1);
    }
    cout << ans << '\n';
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...