In the contest Ocean of Code, I encountered a timeout error. I tried timing my code and I discovered that one line lasted an especially long time.
There it is for Python3 :
x, y, my_life, opp_life, torpedo_cooldown, sonar_cooldown, silence_cooldown, mine_cooldown = [int(i) for i in input().split()]
This line takes around 30ms while the rest of the code takes around 1ms.
I’d like to think that it’s taking some time because the line is simply waiting for the input, but then it should be taken into account and it shouldn’t count in the mandatory response time (≤50ms). If it’s already taken into account then I have no idea why I have a timeout.
Another concern I have is the irregularity of the time taken by this one line (varies between 15 and 60ms). If it is in fact counted in the response time, then what should I do?
(I checked my code and I don’t have any while loop or recursive method that could cause the timeout)