Блог пользователя BluoCaroot

Автор BluoCaroot, история, 7 месяцев назад, По-английски

I was writing a problem on polygon and I came across a problem with the std::rcmp9 checker.

Whenever the output doesn't fit in a double variable it gives AC verdict even if the relative error is greater than 1e-9

I tried making my own version and reading the numbers as strings and then casting them as ld and making ld variations of the check functions but the same thing happens and I can't get correct verdicts, could anyone suggest any solutions?

  • Проголосовать: нравится
  • +12
  • Проголосовать: не нравится

»
7 месяцев назад, # |
  Проголосовать: нравится +7 Проголосовать: не нравится

In the example you gave, the checker works correctly. It checks whether

$$$ \displaystyle \frac{\left| a - b \right|}{\max(1, \left| b \right|)} \le 10^{-9} $$$

Here, $$$\left| a - b \right| = 0.0000019074 \le 2 \cdot 10^{-6}$$$ while $$$b \ge 10^{10}$$$, so

$$$ \displaystyle \frac{\left| a - b \right|}{\max(1, \left| b \right|)} \le \frac{2 \cdot 10^{-6}}{10^{10}} = 2 \cdot 10^{-16} \le 10^{-9}. $$$
  • »
    »
    7 месяцев назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    thank you for clarifying, I thought the error would be calculated as just the difference so this should be considered different if the max error is $$$10^{-6}$$$, but it seems I was wrong. However shouldn't it at least show the difference between them as the error?

    Edit:

    I get now that it's showing the relative error $$$2.10^{-16}$$$ which is small and it only shows first 9 digits from but what should I do for the cases with ld output

    these are the numbers I'm comparing
    and it's clearly seeing them as wrong numbers