# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
523165 | redstonegamer22 | Star triangles (IZhO11_triangle) | C++17 | 295 ms | 5348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |