# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
17682 | Elibay | Star triangles (IZhO11_triangle) | C++14 | 456 ms | 7104 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>
#define Fname "triangles"
using namespace std;
const int MaxN = 3e5 + 17, INF = 1e9 + 17, Mod = 1e9 + 7;
map < int, int > mx;
map < int, int > my;
int x[MaxN], y[MaxN], n;
long long Sum;
int main ()
{
#ifdef Elibay
freopen (".in", "r", stdin);
#endif
scanf ("%d", &n);
for (int i = 1; i <= n; ++ i)
scanf ("%d%d", &x[i], &y[i]), mx[x[i]] ++, my[y[i]] ++;
for (int i = 1; i <= n; ++ i)
Sum += (mx[x[i]] - 1) * (my[y[i]] - 1);
printf ("%lld", Sum);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |