Submission #531950

#TimeUsernameProblemLanguageResultExecution timeMemory
531950christinelynnStar triangles (IZhO11_triangle)C++17
100 / 100
312 ms18500 KiB
#include <bits/stdc++.h> #define REP(v, i, j) for (ll v = i; v < j; v++) #define FORI(v) for (auto i : v) #define FORJ(v) for (auto j : v) #define OUT(v, a) FORI(v) cout << i << a; #define OUTS(v, a, b) cout << v.size() << a; OUT(v, b) #define in(a, n) REP(i, 0, n) cin >> a[i]; #define SORT(v) sort(begin(v), end(v)) #define REV(v) reverse(begin(v), end(v)) #define pb push_back #define fi first #define se second #define detachIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); using namespace std; typedef long long ll; typedef pair<ll, ll> pii; typedef pair<pii, ll> piii; typedef pair<pii, pii> piiii; map<ll, ll> x, y; vector<pii> v; int main() { detachIO; ll N; cin >> N; while (N--) { ll a, b; cin >> a >> b; x[a]++, y[b]++; v.pb({a, b}); } ll ans = 0; FORI(v) { ans += (x[i.fi] - 1) * (y[i.se] - 1); } cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...