0
Time limit in sololearn
what is the limit limit for executing the code in sololearn? I wrote a simple code that writes the time to file and than reads it 100 times. when I raise it to 200 times, I am getting an error. https://code.sololearn.com/c1tH4AyqKBkJ/?ref=app
7 Answers
+ 9
I am not getting any error even if I raise 100 to 500. I think the traffic to code playground is high or your network connection is slow when you did that.
+ 8
import time
time.sleep(4.9)
print("hoi")
#this is the highest I can go without time limit exceeded. so make your code faster than 5 seconds, I guess. unless there is something more at play than real time. but we won't know unless we can deduce it or Sololearn tells us.
+ 7
I tried 50000 times on your code and it worked lol
+ 5
You should try running your code a couple of times. Sometimes you hit a net lag on SoloLearn (more and more often as of recently) which halts the proper code execution :(
+ 5
Ahri's answer looks right on....but that time limit (as the target) may be frustrating. I/O is not actually so simple (despite a language making it simpler)...and the time limit that decides "your code is done now" appears to be "wall time" (not CPU time):
https://en.m.wikipedia.org/wiki/Wall-clock_time
https://en.m.wikipedia.org/wiki/CPU_time
Your code might use 4 CPU seconds...fitting into 5 HUMAN seconds...until 99 other people want CPU time. The scheduler will still give you 4 CPU seconds...it will just be 30 seconds of HUMAN time to do so. SoloLearn may not want stuff hanging around for 30 seconds with energetic new coders so: Kill the process (fewer lines of code run): Time Limit Exceeded.
I believe SoloLearn does predictive scheduling but the fact is...your code isn't optimized*. I have private experiments that work with the CPU scheduler (to be ready when the CPU is), but general purpose code is at the mercy of the scheduling optimizer...which is at the mercy of the current load.
* We don't have much incentive to write optimized code because SoloLearn foots the computation bill (while we foot the "wall time" bill).
+ 2
Time Limit is not a problem to you only.
I have been writing a code.
The issue is the time limit, try every way I could, multi threaded the program but still time limit exceeded.
+ 1
I previously run it on the android app, now I re-run it on a pc, and was able to raise to 20000. seems to depend on the connection. thanks!