Submission #523163

#TimeUsernameProblemLanguageResultExecution timeMemory
523163redstonegamer22Star triangles (IZhO11_triangle)C++17
0 / 100
0 ms204 KiB
#include <bits/stdc++.h>

using namespace std;

#ifndef LOCAL

ifstream in("triangles.in");
ofstream out("triangles.out");

#define cin in
#define cout out

#endif // LOCAL

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...