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

Автор ShockProof, история, 9 лет назад, По-английски

got Wrong answer on test 11 after rejudge 11857092

later just printed two digits after decimal point and got Accepted 11868319

I don't understand the reason... please explain

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

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

The amount of error you allowed in the binary search is 1e-9, so when multiplied by n = 100000, the error can be as high as 1e-4, which is too much. Therefore if the answer is 2, you could print something (about) as far off as 2.0001, which would be considered wrong. However, it happens that in this problem the answer is always a multiple of .5, when you printed to 2 decimal places you would always be close enough to that multiple of .5 that you would round to exactly that answer.