# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1219531 | mariamtsagareli | Star triangles (IZhO11_triangle) | C++20 | 80 ms | 7792 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin>>n;
vector<pair<long long,long long>>p(n);
unordered_map<long long,int> cx, cy;
for (int i=0;i<n;i++){
long long x,y;
cin>>x>>y;
p[i]={x, y};
cx[x]++;
cy[y]++;
}
long long ans=0;
for (int i=0;i<n;i++) {
auto [x, y]=p[i];
ans+=(long long)(cx[x] - 1)*(cy[y] - 1);
}
cout<<ans<<"\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |