+ 2
how can i run a infinite loop for ALMOST infinite time in solo learn?
8 Antworten
+ 5
I hope it is unavaible. The code is running on SoloLearn servers then infinite loops can block these servers.
+ 4
Time is limited to 10 seconds (I guess. Most serverside compilers are limited to 10s so I think sololearn's too ^^)
+ 4
It's actually just 5 seconds...
https://code.sololearn.com/cdisk9L6pJn8/?ref=app
+ 2
Alex Why isn't it exactly 5 but 4.4 to 4.7?
+ 2
You can only do that with javascript.
+ 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.
+ 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.
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