0

How much time do you have to run your program?

I think you have 5 seconds to run it all otherwise it will say "Time limit exceeded" but while I was trying I found something interesting. https://code.sololearn.com/cOz9ObfUQmQX/?ref=app It's very easy. Python code import time time.sleep(4.95) print("Hello world") I used 4.95 because also importing and printing take some times. The output is: Hello World Time limit exceeded How is that possible? Edit: I tried to do it again and it didn't worked. So I start changing the time and I got it again at 4.815 maybe it's just a matter of connection?

5th Sep 2018, 8:31 AM
Daniele Bonomi
Daniele Bonomi - avatar
6 Answers
+ 2
its a sololearn thing its not a live interpreter. it processes it on server and outputs the output. if the process takes over 5secs it times out
5th Sep 2018, 9:54 AM
Markus Kaleton
Markus Kaleton - avatar
+ 1
This time only for sololearn playground if you run your code on computer with offline ide then you can sleep your code 1 hour or according to your need.
5th Sep 2018, 4:36 PM
Maninder $ingh
Maninder $ingh - avatar
0
Yes but how did I got both the output and time limit exceeded in the same run?
5th Sep 2018, 1:10 PM
Daniele Bonomi
Daniele Bonomi - avatar
0
sometimes you do. probably returns possible generated values if they are stored for the return even if the limit exceeds
5th Sep 2018, 1:37 PM
Markus Kaleton
Markus Kaleton - avatar
0
But usually no output is printed if the limit exceeded
5th Sep 2018, 3:07 PM
Daniele Bonomi
Daniele Bonomi - avatar
0
Yeah of course you have 5 sec only because otherwise you could do a denial of services attack
5th Sep 2018, 5:24 PM
Daniele Bonomi
Daniele Bonomi - avatar