+ 19

Time limit exceeded in python

The program compiles successfully and is free from any bugs but while execution i get this error after partially obtaining the results. what is the default time limit? what are possible solutions for this error? can we define separately the time limit required for execution by a particular program?

7th Jan 2018, 5:01 PM
⛎Ⓜ️ €⚡♓
10 Answers
+ 18
@ace @john Wells thanks for your post But is there any way to find out what is the allotted time for execution on server? Can we manually define the time for execution in code or by any other means before actual execution of code?
8th Jan 2018, 7:40 AM
⛎Ⓜ️ €⚡♓
+ 16
@kirk Schafer thanks for the code👍
10th Jan 2018, 7:36 AM
⛎Ⓜ️ €⚡♓
+ 13
There are 2 cases now. It depends on the 2 numbers, which are given as input. If u start from 0, then for a range of 1000 approximately, I get this problem. Again if I select a higher numbers, for example (10000 to 10500) I get it again
7th Jan 2018, 7:13 PM
⛎Ⓜ️ €⚡♓
7th Jan 2018, 6:15 PM
⛎Ⓜ️ €⚡♓
+ 11
What I believe is happening with your code is your loops are causing a timeout on the server for certain values. Your code is given a certain amount of time to execute once it reaches the server. If it doesn't complete within the allotted time frame, it times out.
8th Jan 2018, 2:31 AM
Ace - avatar
+ 9
And what range are you experiencing the problem?
7th Jan 2018, 6:29 PM
Ace - avatar
+ 8
Can we see your code? You say there are no errors, but just because there are no compiler errors doesn't mean your code is correct.
7th Jan 2018, 5:21 PM
Ace - avatar
+ 4
I've reported timeout is ~4-5 seconds for a while, but based on codes for another purpose + never explained. So... here's proof with codes written for measuring TLE. Timeout (seconds; run until I got 5 samples each): 1: not responding 2: 4.95, 4.95, 4.94, 4.95, 4.95 3: 4.95, 4.93, 4.97, 4.95, 4.9978 (< 5) 4: 4.95, 4.95, 4.97, 4.95, 5.08 (anomalous > 5) edit: Another @ 5.76. The control script may allow a rare split-second that should not exceed variance 1. https://code.sololearn.com/cZDI0lib4Dj5/?ref=app https://code.sololearn.com/cmilKMcdLY1L/?ref=app
9th Jan 2018, 4:10 AM
Kirk Schafer
Kirk Schafer - avatar
+ 3
Also, the length of time varies based on server load or timeframe. People have reported programs working to completion sometimes and only getting part way through on other runs with no changes (me included.)
8th Jan 2018, 2:53 AM
John Wells
John Wells - avatar
+ 2
It is not possible to have any interaction with the server.
8th Jan 2018, 11:30 AM
John Wells
John Wells - avatar