Submission #645588

#TimeUsernameProblemLanguageResultExecution timeMemory
645588ymmStar triangles (IZhO11_triangle)C++17
100 / 100
307 ms8144 KiB
#include <bits/stdc++.h> #define Loop(x,l,r) for (ll x = (l); x < (r); ++x) #define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x) typedef long long ll; typedef std::pair<int, int> pii; typedef std::pair<ll , ll > pll; using namespace std; int main() { cin.tie(0) -> sync_with_stdio(false); int n; map<int, int> X, Y; vector<pii> a; cin >> n; while (n--) { int x, y; cin >> x >> y; X[x]++; Y[y]++; a.push_back({x, y}); } ll ans = 0; for (auto [x, y] : a) ans += (ll)(X[x]-1) * (Y[y]-1); cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...