# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
532928 | devariaota | Star triangles (IZhO11_triangle) | C++17 | 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;
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;
}