Need help with problem 1822G2

Правка en1, от nairarjun1997, 2023-07-06 23:35:27

I'm trying to solve https://codeforces.net/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:

  1. n / b^2 == sqrt(n). In this case, b == fourthroot(n). So, we count that if b is valid.
  2. n / b == sqrt(n). In this n / b == sqroot(n), and n / b^2 == 1, so we count that, if b is valid.
  3. n / b^2 > sqrt(n). In this case, b < fourthroot(n), so we try all possible b.
  4. 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:
      1. 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.
      2. n / b^2 >= b. In this case b^3 <= n, so we try all b.

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.net/contest/1822/submission/212470854. The submission is a real mess.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский nairarjun1997 2023-07-07 03:13:39 176
en2 Английский nairarjun1997 2023-07-07 00:42:18 122
en1 Английский nairarjun1997 2023-07-06 23:35:27 1354 Initial revision (published)