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

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

Can someone please identify the problem with the submission 24848243 . It got hacked during the contest by Endagorion and I resubmitted it by removing the floor which I had used unnecessarily while computing total range for a given n. I don't think it should make a difference though. Resubmission ID : 24860951

Thanks in advance.

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

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

Auto comment: topic has been updated by eat_code (previous revision, new revision, compare).

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

Your Hacktest is
1125899906842623 1125899906742623 1125899906842623
I tested this on my Accepted Code. It prints 100001 on Codeforces but on Ideone and my PC it prints 50000.
Can someone please explain this ?

  • »
    »
    7 лет назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    Even my code had the output 5000 for the hacktest. Also hacktest is one of the maintests(test 29)

    • »
      »
      »
      7 лет назад, # ^ |
      Rev. 2   Проголосовать: нравится +2 Проголосовать: не нравится

      I just changed log2() to my own LOG2() function and now its working fine.
      Now I can see the reason why all top coders use their own log function. Never use C++ log() and pow() function or any similar function as it may give unexpected results on some machine.

      I just added my own log function to your rejected code and now it gives correct output 100001 for the hacktest.

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

1125899906842623=2^50-1. Perhaps it's because of the loss of significance when you use the floor.