I'm trying to solve https://codeforces.me/contest/1822/problem/G2.
My approach was to count the triplets by splitting the set of triplets by the largest value of the triplets. So, I count for every possible largest value in a triplet. Let's call a given possible largest value "n". I broke down the problem into the following cases:
- n / b^2 == sqrt(n). In this case, b == fourthroot(n). So, we count that if b is valid.
- n / b == sqrt(n). In this n / b == sqroot(n), and n / b^2 == 1, so we count that, if b is valid.
- n / b^2 > sqrt(n). In this case, b < fourthroot(n), so we try all possible b.
- n / b^2 < sqrt(n) and n / b > sqroot(n). In this case, we get constrains b < sqrt(n), b > fourthroot(n).
- We split the fourth case into two more cases:
- n / b^2 < b. In this case, b^3 > n, so b^2 > n^(2/3), so b^2/n > n^(2/3)/n, so n/b^2 < n^(1/3). So, we count all possible values of n/b^2.
- n / b^2 >= b. In this case b^3 <= n, so we try all b.
- We split the fourth case into two more cases:
I'm looking for help with a case I missed, since it looks like I'm undercounting. Maybe I have some sort of overflow, but I don't see where that would be possible.
Here's my submission which fails the third test case: https://codeforces.me/contest/1822/submission/212470854. The submission is a real mess.