# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
531534 | christinelynn | Star triangles (IZhO11_triangle) | C++17 | 400 ms | 10208 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;
#define int long long
signed main(){
cin.tie(0) -> ios_base::sync_with_stdio(0);
int n;
cin >> n;
vector<int> x(n), y(n);
map<int,int> px, py;
for(int i=0;i<n;i++)
{
cin >> x[i] >> y[i];
px[x[i]]++;
py[y[i]]++;
}
int ans = 0;
for(int i=0;i<n;i++)
{
int cx = 0, cy = 0;
if(px.count(x[i])) cx = px[x[i]];
if(py.count(y[i])) cy = py[y[i]];
ans += (cx - 1) * (cy - 1);
}
cout << ans << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |