Time limit exceeded in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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
⛎Ⓜ️ €⚡♓
7 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
⛎Ⓜ️ €⚡♓
+ 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