Submission #163295

#TimeUsernameProblemLanguageResultExecution timeMemory
163295tselmegkhStar triangles (IZhO11_triangle)C++14
100 / 100
1063 ms13580 KiB
#include<bits/stdc++.h> using namespace std; map<int, int> cntx, cnty; int main(){ int n; cin >> n; vector<pair<int, int>> stars; for(int i = 0; i < n; i++){ int x1, y1; cin >> x1 >> y1; stars.push_back({x1, y1}); cntx[x1]++, cnty[y1]++; } long long ans = 0; for(pair<int, int> st : stars){ int x = st.first, y = st.second; ans += (cntx[x] - 1) * (cnty[y] - 1); } cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...