Submission #1044294

#TimeUsernameProblemLanguageResultExecution timeMemory
1044294EntityPlanttStar triangles (IZhO11_triangle)C++17
100 / 100
72 ms11980 KiB
#include <iostream> #include <unordered_map> using namespace std; const int N = 3e5 + 5; pair <int, int> s[N]; unordered_map <int, int> mx, my; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, ans = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> s[i].first >> s[i].second; mx[s[i].first]++; my[s[i].second]++; } for (int i = 0; i < n; i++) { ans += (mx[s[i].first] - 1) * (my[s[i].second] - 1); } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...