Question: in Python3 preferably, even java c# will do The evil lord has captured n of the logicians in his land. All of them are in



The evil lord has captured n of the logicians in his land. All of them are in prison, and each individual is locked in a different prison. Fortunately, the guards forgot to lock the door for one of these prisoners, and the prisoner escapes. An escaped prisoner can then unlock other locked prisons. The newly opened prisoner then escapes. Every second, the escaped prisoners can unlock one prison each, and the unlocked prisoners join in the next second. For example, at the oth second, we have one escaped prisoner, which can unlock another prisoner. Therefore, at the 1st second, we will have two escaped prisoners, which can then similarly free other prisoners. As the prisoners are logicians, they are smart and always act optimally They want all the prisoners to be free as soon as possible (before the As the prisoners are logicians, they are smart and always act optimally. They want all the prisoners to be free as soon as possible (before the guards realize the breach). Calculate the minimum time needed to release all the n prisoners. Input Format The first line contains an integer, n, denoting the number of prisoners. Constraints 1 2) the first prisoner un dels the Sel the remaining prisoner So, by 2nd second we have all the prisoners free. 1 The first prisoner is free from the start (Oth second) 2 oth second-(1-> 2), the first prisoner unlocks the second prisoner 1st second-(1-> 3) and (2-> 4), the first unlocks the third prisoner and the second unlocks the fourth prisoner 7 BO By acting optimally all the prisoners can be free by the 7th Second
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
