# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1092338 | DeathIsAwe | Star triangles (IZhO11_triangle) | C++17 | 179 ms | 11844 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;
#define mp make_pair
#define ff first
#define ss second
#define ll long long
unordered_map<int,int> xcoords, ycoords;
int main() {
int n; cin >> n;
vector<pair<int,int>> coords(n);
for (int i=0;i<n;i++) {
cin >> coords[i].ff >> coords[i].ss;
if (xcoords.find(coords[i].ff) == xcoords.end()) {
xcoords[coords[i].ff] = 1;
} else {
xcoords[coords[i].ff] += 1;
}
if (ycoords.find(coords[i].ss) == ycoords.end()) {
ycoords[coords[i].ss] = 1;
} else {
ycoords[coords[i].ss] += 1;
}
}
ll ans = 0;
for (pair<int,int> i: coords) {
ans += (ll)(xcoords[i.ff] - 1) * (ll)(ycoords[i.ss] - 1);
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |