Submission #523163

# Submission time Handle Problem Language Result Execution time Memory
523163 2022-02-07T07:01:46 Z redstonegamer22 Star triangles (IZhO11_triangle) C++17
0 / 100
0 ms 204 KB
#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 time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -