# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
523163 | redstonegamer22 | Star triangles (IZhO11_triangle) | C++17 | 0 ms | 204 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;
#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 |
---|---|---|---|---|
Fetching results... |