# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
227522 | _ani | Star triangles (IZhO11_triangle) | C++14 | 762 ms | 13304 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 <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
const int maxn = 300002;
int n, x[maxn], y[maxn];
map <int, long long> mx, my;
long long ans;
int main()
{
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> x[i] >> y[i];
mx[x[i]]++;
my[y[i]]++;
}
for (int i = 0; i < n; i++)
{
ans += (mx[x[i]] - 1) * (my[y[i]] - 1);
}
cout << ans << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |