Submission #212870

#TimeUsernameProblemLanguageResultExecution timeMemory
212870islingrStar triangles (IZhO11_triangle)C++14
100 / 100
360 ms12456 KiB
#include <algorithm> #include <iostream> #include <vector> #include <map> using namespace std; #define rep(i, a, b) for (auto i = (a); i < (b); ++i) #define per(i, a, b) for (auto i = (b) - 1; i >= (a); --i) #define trav(x, v) for (auto &x : v) #define ff first #define ss second using ll = int64_t; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<pair<int, int>> v(n); map<int, int> x, y; trav(p, v) { cin >> p.ff >> p.ss; ++x[p.ff]; ++y[p.ss]; } ll ans = 0; trav(p, v) ans += 1ll * (x[p.ff] - 1) * (y[p.ss] - 1); cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...