A man throws a ball from the ground towards the top of a cliff. Suppose that as soon as the ball reaches its maximum height, the ball lands on top of the cliff.

Let time t=0 be the moment the ball is released from the man's hand. For simplicity's sake, let the ball reach a maximum height of 4 at t=2. Assuming "gravity" is the only force acting on the object once released, the ball's movement can be described by following function:
$$y(t)=\begin {cases}-(t-2)^2+4 &\text{if } 0<t<2\\ 4 &\text{if }t\ge2\end{cases}$$
This seems all good; y is a continuous function, and
$$y'(t)\begin {cases}-2(t-2) &\text{if } 0<t<2\\ 0 &\text{if }t\ge2\end{cases}$$
is continuous. But
$$y''(t)\begin {cases}-2 &\text{if } 0<t<2\\ 0 &\text{if }t\ge2\end{cases}$$
is clearly not continuous. This means that the ball would have an infinite change in its acceleration. So this movement is not possible. Are you not able to throw a ball onto a cliff so that it reaches its max height when it reaches the top of the cliff?
As in your drawing, you can think of the ball as coming to rest on the top of the cliff. To the first approximation, there is no problem with an infinite change in the acceleration. It lands on the cliff and stops. At another approximation, you need to supply upward force on the ball to stop it from falling. That force has to come from slightly compressing the ground the ball rests on and the bottom of the ball, so the ball will descend a very small distance from its peak to establish these forces.
Similar issues occur if you think of a car starting to turn instantaneously. On one level, you can go from zero transverse acceleration to some amount instantaneously. On the next level, you need to rotate the steering wheel, transmit that to the tires, get them to deform, and so on to initiate the turn. None of this happens instantaneously, but it is close enough.