We accelerate and then when there is no choice anymore, we decelerate. Indeed, if your minimal deceleration decelaration was infinite, you would have been able to decelerate completely brutaly at the end and that would have been the best. Now you have to tend to that limit. The idea to prove it is to look at how to optimize the distance because it's more simple to do it.
Let's write $v_M$ the maximal velocity. Deceleration is from $v_M$. Then the time to decelerate with the minimal decelaration $a_m$ is $t_d=v_M/a_m$ on a distance $l_d=\int_0^{t_d}(v_M-a_m t)dt=v_M t-a_m t^2/2 $. Now the maximal acceleration is $a_M$. Then $v(t)=\int^t_0 a_M t'dt'=a t$. And $x(t)=at^2/2$. At $t_M$ we got to the maximal velocity : $v_M=a t_a$ and the distance $l_a=at_a^2/2$. We have $L=l_a+l_d=a_M t_a^2/2+(a_M t_a) (a_M t_a /a_m)-a_m (a_M t_a/a_m)^2/2=t_a^2(a_M/2-a_M^2/a_m/2)$.
Ok now you can finish. You have $t_a$, so you have $l_a$. But then you have also $l_d=L-l_a$. And from this you get $t_d$, and then $T=t_a+t_d$.
I hope I didn't do too much mistakes :)
I didn't write the whole answer with a rigourous proof to my answer. But that's a sketch of how to tackle the issue.