# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
675751 | QwertyPi | Star triangles (IZhO11_triangle) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
struct point{
int x, y;
};
vector<point> P;
map<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;
}