Submission #675752

#TimeUsernameProblemLanguageResultExecution timeMemory
675752QwertyPiStar triangles (IZhO11_triangle)C++14
100 / 100
458 ms13348 KiB
#include <bits/stdc++.h> using namespace std; struct point{ int x, y; }; vector<point> P; map<int, int> X, Y; int main(){ int n; cin >> n; for(int i = 0; i < n; i++){ int x, y; cin >> x >> y; P.push_back({x, y}); X[x]++; Y[y]++; } int ans = 0; for(int i = 0; i < n; i++){ ans += (X[P[i].x] - 1) * (Y[P[i].y] - 1); } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...