Codeforces functionality may be limited from June 18, 19:00 (UTC) to June 19, 3:00 AM (UTC) due to technical maintenance. Polygon will work as usual. ×

Majedh's blog

By Majedh, history, 18 months ago, In English

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

  • Vote: I like it
  • -6
  • Vote: I do not like it

| Write comment?
»
18 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
18 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
18 months ago, # |
  Vote: I like it +5 Vote: I do not like it

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.

»
18 months ago, # |
Rev. 2   Vote: I like it +8 Vote: I do not like it

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

»
18 months ago, # |
  Vote: I like it 0 Vote: I do not like it

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