# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
335611 | StanCatalin | Star triangles (IZhO11_triangle) | C++14 | 1 ms | 364 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 <fstream>
using namespace std;
ifstream in("triangles.in");
ofstream out("triangles.out");
const int dim = 3e5 + 5;
int n,lin[dim],col[dim];
pair<int,int> a[dim];
int main()
{
in >> n;
for (int i=1; i<=n; i++)
{
in >> a[i].first >> a[i].second;
lin[a[i].first]++;
col[a[i].second]++;
}
int ans = 0;
for (int i=1; i<=n; i++)
{
ans += (lin[a[i].first] - 1) * (col[a[i].second] - 1);
}
out << ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |