Submission #1092338

#TimeUsernameProblemLanguageResultExecution timeMemory
1092338DeathIsAweStar triangles (IZhO11_triangle)C++17
100 / 100
179 ms11844 KiB
#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 timeMemoryGrader output
Fetching results...