+ 2

how can i run a infinite loop for ALMOST infinite time in solo learn?

4th Apr 2018, 4:51 PM
aditya
aditya - avatar
8 Réponses
+ 5
I hope it is unavaible. The code is running on SoloLearn servers then infinite loops can block these servers.
4th Apr 2018, 4:56 PM
Bartosz Pieszko
Bartosz Pieszko - avatar
+ 4
Time is limited to 10 seconds (I guess. Most serverside compilers are limited to 10s so I think sololearn's too ^^)
4th Apr 2018, 4:56 PM
Alex
Alex - avatar
+ 4
It's actually just 5 seconds... https://code.sololearn.com/cdisk9L6pJn8/?ref=app
4th Apr 2018, 5:25 PM
Alex
Alex - avatar
+ 2
Alex Why isn't it exactly 5 but 4.4 to 4.7?
5th Apr 2018, 12:49 PM
Timon Paßlick
+ 2
You can only do that with javascript.
5th Apr 2018, 12:49 PM
Timon Paßlick
+ 2
I do not know. This is very likely to be the reason. I posted this question because maybe a mod who knows the implementation of SoloLearn could see it.
5th Apr 2018, 1:20 PM
Timon Paßlick
+ 1
The server lag does matter. I know that because the overhead within the code is mostly constant, but the server lag is not. Your overhead is very minimal, under 0.1 seconds.
5th Apr 2018, 1:35 PM
Timon Paßlick
0
Timon Paßlick I have the feeling you know the answer. :D I actually didn't think about that, but I guess it's mainly the cout which costs a bit of time each loop? I optimised it a bit and now it's closer to the 5k mark. But now always. And the time between the prints is also not a constant. So server lags also lower the max execution time? And the code execution most likely ends in the sleep time. So you need to add 0<= n <= sleep ms to the final value. Let me know if this is right or if wrong let me know the right answer. https://code.sololearn.com/cfIK0MA5m8YX/?ref=app
5th Apr 2018, 1:17 PM
Alex
Alex - avatar