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

Автор Majedh, история, 2 года назад, По-английски

Hello everyone one Yesterday i participated in the codeforces edu contest "139" I solved problem D But in the open hack phase I got hacked "184970835" I tried the same code today but with different compiler and got accepted "185050950" Why this thing happend ? That's why I ask MikeMirzayanov for help me

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

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

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

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

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

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

Because of the system flowing, your execution time will have a flow of maybe +-200ms. The system judges your code only once on the hack phrase, but when you submit a code in practice mode your code will be judge for three times, if your code passes for one time then your code is accepted. Moreover, maybe the hacker tried to hack you for many times, and if there is one time that your code exceeds the time limit then you are hacked.

In contests with open hacking phrase, people may hack you many times but have no penalty. So you need to optimize your code to a "safe range", in case being hacked. For example, if your code runs 1400ms in problem D in the worse situation, and the time limit is 4000ms, then you will not be hacked. Be careful if your code passes pretests in a dangerous time, like 3972ms.

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

I think this is related to the new 64-bit compiler since you are using only long long variables

I used your exact same code but with integer variables and it got AC

Also, it barely passed the time limit anyways this solution should not pass

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

This is normal. C++20 is faster than C++17.