+ 1

Can IDLE do this?

I have attached a link to my code. This always comes up as No Output, Time Limit Exceeded or (very rarely) the answer. Is my program wrong or is it just Sololearn? https://code.sololearn.com/cG2XlpbDzwM2/?ref=app

10th Nov 2017, 7:17 AM
Max S
17 Respuestas
+ 9
@Pegasus the higher the passes, there is more chances of timeout. Tried more scenarios of timeout.
10th Nov 2017, 10:20 AM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
+ 7
Works for me. Entered 30. Retrieve in 13 passes.
10th Nov 2017, 10:13 AM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
+ 6
It works with no problem. Sometimes the sololearn server is busy. In this case you get a timout even your prog is ok.
10th Nov 2017, 7:43 AM
Oma Falk
Oma Falk - avatar
+ 5
Timeout has to do with the code taking like maybe 5 seconds or smthing like that to run
10th Nov 2017, 10:21 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
Ues but even if one case fails, it means the whole thing is wrong
10th Nov 2017, 11:16 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
thats it! working examples are necessary conditions for a correct algorithm. one not working example is a sufficient condition for a not working algorithm.
10th Nov 2017, 11:16 AM
Oma Falk
Oma Falk - avatar
+ 4
Even if it takes an infinite amount of time to do so, IDLE WILL do it. But this also shows your algorithm is pretty inefficient.
10th Nov 2017, 8:20 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
@Apoorva try 715
10th Nov 2017, 10:15 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
@Max somethings going wrong.., try this with 499 and you will see https://code.sololearn.com/cvKK2oH6s4oq/?ref=app
10th Nov 2017, 10:42 AM
Oma Falk
Oma Falk - avatar
+ 4
715 is a magical number. A good test case. Both failed. Binary search is quite inefficient
10th Nov 2017, 10:44 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
A nice case of: even if many examples work, it is not a proof that the Algorithm is correct.
10th Nov 2017, 11:14 AM
Oma Falk
Oma Falk - avatar
+ 4
@Max see comments in my code. Might be the solution
10th Nov 2017, 12:59 PM
Oma Falk
Oma Falk - avatar
+ 4
@Max indeed! The operator // returns an integer
10th Nov 2017, 1:28 PM
Oma Falk
Oma Falk - avatar
+ 2
Ok.
10th Nov 2017, 8:21 AM
Max S
+ 1
Oh ok thanks.
10th Nov 2017, 7:53 AM
Max S
0
Ok will change it. Thanks for feedback. :)
10th Nov 2017, 12:54 PM
Max S
0
Fixed it.
10th Nov 2017, 1:22 PM
Max S