# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
532928 | 2022-03-04T08:45:47 Z | devariaota | Star triangles (IZhO11_triangle) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; map<int, int> mpx; map<int, int> mpy; pair<int, int> coor[n+5]; for(int i = 1; i<=n; i++) { int a, b; cin >> a >> b; coor[i] = {a, b}; mpx[a]++; mpy[b]++; } long long total1 = 0; for(int i = 1; i<=n; i++) { total1 += 1ll*mpx[coor[i].first]-1)*(mpy[coor[i].second]-1); } cout << total1 << endl; }