Submission #1126206

#TimeUsernameProblemLanguageResultExecution timeMemory
1126206qrnStar triangles (IZhO11_triangle)C++17
100 / 100
551 ms32720 KiB
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

#define intt long long
#define pb push_back
#define endl "\n"
#define ALL(x) x.begin(), x.end()

void solve() {
    int n, x, y;
    cin >> n;
    set<vector<int>> se;
    for (int i = 0; i < n; i++){
        cin >> x >> y;
        se.insert({x, y});
    }
    map<intt, intt> mx, my;
    for (auto mpmppmpmp : se){
        mx[mpmppmpmp[0]]++;
        my[mpmppmpmp[1]]++;
    }
    intt ans = 0;
    for (auto mpmppmpmp : se){
        ans += (mx[mpmppmpmp[0]] - 1) * (my[mpmppmpmp[1]] - 1);
    }
    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    intt tst = 1;
    // cin >> tst
    while (tst--) {
        solve();
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...