Submission #523165

#TimeUsernameProblemLanguageResultExecution timeMemory
523165redstonegamer22Star triangles (IZhO11_triangle)C++17
100 / 100
295 ms5348 KiB
#include <bits/stdc++.h>

using namespace std;

int main() {
    unordered_map<int, int64_t> xs;
    unordered_map<int, int64_t> ys;

    int n; cin >> n;
    vector<pair<int, int>> v(n);
    for(auto &e : v) cin >> e.first >> e.second;
    for(auto e : v) {xs[e.first] += 1; ys[e.second] += 1;}

    int64_t ans = 0;
    for(auto e : v) {
        ans = (1LL * ans + (xs[e.first] - 1) * (ys[e.second] - 1));
    }

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